Syntax Highlighting

Note: Emanote documentation is a work-in-progress

In order to enable syntax highlighting, you must use a client-side JavaScript highlighter, such as highlight.js by adding it to page.headHtml of YAML configuration (if adding to all or multiple routes) or Markdown frontmatter (if adding to a single route). Emanote already provides a snippet, so you may directly include the following in your index.yaml (assuming you are enabling it on all routes):

  headHtml: |
    <snippet var="js.highlightjs" />

(Source code for the <snippet var="js.highlightjs" /> alias can be found in the file, under the js: YAML map)

Bear in mind that when using highlight.js you must manually add language support. The above snippet includes Haskell by default; otherwise, it is normally added as:

  headHtml: |
    <snippet var="js.highlightjs" />
    <with var="js">
    <script src="${value:highlightjs-ver}/languages/haskell.min.js"></script>

(The highlightjs-ver variable also comes from the default index.yaml)

Example (highlight.js)


def fib(n):
    a, b = 0, 1
    while a < n:
        print(a, end=' ')
        a, b = b, a+b


fib 0 = 0
fib 1 = 1
fib n = fib (n-1) + fib (n-2)