Use syntax highlighting in a wiki

You can highlight snippets of text on your Bitbucket Cloud wiki pages. We use the excellent Pygments library to style our code. Here is an example of some Python code, formatted in a Bitbucket wiki:

The syntax you use to format the code block depends on which language you choose for your wiki. Make sure you know which language you are using.  You can see the current language when the Wiki is in Edit mode.

Then use the appropriate syntax to format the code as shown above:

Markdown Creole
```
#!python

def wiki_rocks(text):
	formatter = lambda t: "funky"+t
	return formatter(text)
```
{{{
#!python

def wiki_rocks(text):
	formatter = lambda t: "funky"+t
	return formatter(text)
}}}
Textile reStructuredText
bc. #!python
def wiki_rocks(text):
	formatter = lambda t: "funky"+t
	return formatter(text)

.. sourcecode :: python
 
 def wiki_rocks(text):
    formatter = lambda t: "funky"+t
    return formatter(text)

For details on the various languages, see their corresponding documentation on the web. See the library of Pygment lexers. Bitbucket Cloud supports the short name or the mimetype of anything in that library.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport