Use syntax highlighting in a wiki
You can highlight snippets of text on your Bitbucket Cloud wiki pages. We use the excellentPygments library to style our code.
The syntax you use to format the code block depends on the language you choose for your wiki. To check the language, clickEdit at the top right of you wiki page and look for theLanguage dropdown.
Then use the appropriate syntax to format the code as shown above:
Markdown | Creole |
|---|---|
```pythondef wiki_rocks(text):formatter = lambda t: "funky"+treturn formatter(text)```Using triple backticks with a shebang to specify language is no longer supported. Instead, use the triple backticks with the language, as shown in the example above. | {{{#!pythondef wiki_rocks(text):formatter = lambda t: "funky"+treturn formatter(text)}}} |
Textile | reStructuredText |
bc. #!pythondef wiki_rocks(text):formatter = lambda t: "funky"+treturn 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. Seethe library of Pygment lexers. Bitbucket Cloud supports the short name or the mimetype of anything in that library.
Was this helpful?