The actual parser function, fully parsing the specified input and returning a document tree.
The actual parser function, fully parsing the specified input and returning a document tree.
Adds the specified Laika directives and returns a new instance of the parser.
Adds the specified Laika directives and returns a new instance of the parser.
Example:
val templates = DefaultTemplate withDirectives ( Templates.create("ticket") { (attribute(Default) ~ attribute("param").optional) { (ticketNo, param) => val base = "http://tickets.service.com/"+ticketNo val url = base + (param map (p => "¶m="+p) getOrElse "") TemplateElement(ExternalLink(Seq(Text("Ticket "+ticketNo)), url, options = Styles("ticket"))) } } ) Transform from Markdown to HTML withConfig RootDirectory("my-home") .withTemplates(ParseTemplate as templates)
The code above registers a template directive that detects markup like
@:ticket 2356.
and turns it into an external link node for the
URL http://tickets.service.com/2356
.
For more details on implementing Laika directives see laika.directives.Directives.
The default template parser, with all standard directives but no custom directives installed .