On this page:
highlight
7.0

15.1 Pygments

 (require pollen/unstable/pygments) package: pollen

A simple interface to syntax highlighting using Pygments. You must already have Pygments installed to use this module. See the mini-tutorial Using Pygments with Pollen.

procedure

(highlight language lines-of-code ...)  txexpr?

  language : symbol?
  lines-of-code : string?
Use Pygments to highlight the code in lines-of-code according to the semantics of language. Does not apply any visual styling, just the markup.

Sample input:

#lang pollen
(require pollen/unstable/pygments)
highlight['python]{
for x in range(3):
    print x
}

Output from this sample:

'(div ((class "highlight")) (table ((class "sourcetable")) (tbody () (tr () (td ((class "linenos")) (div ((class "linenodiv")) (pre () "1\n2"))) (td ((class "code")) (div ((class "source")) (pre () (span ((class "k")) "for") " " (span ((class "n")) "x") " " (span ((class "ow")) "in") " " (span ((class "nb")) "range") (span ((class "p")) "(") (span ((class "mi")) "3") (span ((class "p")) "):") "\n " (span ((class "k")) "print") " " (span ((class "n")) "x") "\n")) "\n")))) "\n")