December 24, 2017, at 07:42 PM (0 comments)
The Pm Pygment recipe is now installed on OborWiki (off by default; you can enable it via the Configurator). It adds syntax highlighting for code blocks, via the Pygments syntax highlighter.
The basic usage is simple:
(:sourcecode lang="go" style="rainbow_dash":) package main import "fmt" func main() { fmt.Println("Hello World") } (:sourcecodeend:) |
|
A neat trick, however, is that you can also use it with the Pastebin Embed (Added 2017-12-25: or Gist Embed) recipe—retrieving the raw text of the paste, and letting Pm Pygment do the syntax highlighting for you:
(:sourcecode lang="go" style="rainbow_dash":) (:pastebin-embed T3rxzk4N raw no-pre:) (:sourcecodeend:) |
|
(Note that the no-pre
argument to the (:pastebin-embed:)
directive is required for this to work.)
Here’s a longer example:
(:sourcecode lang="cpp" style="manni":) (:pastebin-embed svHLwueV raw no-pre:) (:sourcecodeend:) |
|
See the Pm Pygment info page for more detailed documentation/instructions.