Table of Contents


This module documents the builtin Markdown parser.

Use require( hop.markdown ) to use it.

Hop.js extends the genuine markdown syntax by supporting embedded Hop.js expressions. As JavaScript template strings, expression starting with the prefix ${ are evaluated and the result of this evaluation is added as is in the parsed HTML tree.


markdown.load( file )

Parse a markdown file. On success, returns an object with the following properties:

The evaluation environment of the embedded expressions contains the following global variables:

markdown.eval( string )

Parse a markdown string. On success the result is an object with the following properties:


<markdown.MARKDOWN src charset fontifier>

A wrapper to the markdown.eval function that let's markdown documents be directly inserted into HTML containers.


This example shows how to embed markdown elements into HTML.

The example uses a service that returns an HTML document whose sole element is a markdown text. Before being delivered to the client, the markdown text is parsed and automatically compiled into HTML.


var md = require( hop.markdown );

service mdtag( o ) {
   var name = o && "name" in o ? : "bar";
   return <html>
toto n'est pas content

  * toto
  * tutu ${name}
  * titi
tutu non plus.

console.log( "Go to \"http://%s:%d/hop/mtag\"", hop.hostname, hop.port );