The file suffixes recognized by this parser.
The file suffixes recognized by this parser. When transforming entire directories only files with names ending in one of the specified suffixes will be consired.
It is recommended not to support txt
or similarly common suffixes as this might interfere
with other installed formats.
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.
Turns strict mode on for the returned parser, switching off any features not part of the original Markdown syntax.
Turns strict mode on for the returned parser, switching off any features not part of the original Markdown syntax. This includes the registration of directives (custom tags) as well as configuration sections at the start of the document or id generation for all headers.
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:
case class Note (title: String, content: Seq[Block], options: Options = NoOpt) extends Block with BlockContainer[Note] val md = Markdown withBlockDirectives ( Blocks.create("note") { (attribute(Default) ~ body(Default))(Note(_,_)) } ) Transform from md to HTML fromFile "hello.md" toFile "hello.html"
For more details on implementing Laika directives see laika.directives.Directives.
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 md = Markdown withSpanDirectives ( Spans.create("ticket") { (attribute(Default) ~ attribute("param").optional) { (ticketNo, param) => val base = "http://tickets.service.com/"+ticketNo val url = base + (param map (p => "?param="+p) getOrElse "") ExternalLink(Seq(Text("Ticket "+ticketNo)), url, options = Styles("ticket")) } } ) Transform from md to HTML fromFile "hello.md" toFile "hello.html"
The code above registers a span 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.
Returns a Markdown parser that also parses verbatim HTML elements alongside the standard Markdown markup.
Returns a Markdown parser that also parses verbatim HTML elements alongside the standard Markdown markup. Usually only recommended when used together with an HTML renderer, as such a parser returns a document tree that contains HTML elements which some parsers would not know how to handle.
A parser for Markdown text. Instances of this class may be passed directly to the
Parse
orTransform
APIs:Since this library is not solely focused on producing HTML output, parsing verbatim HTML elements like defined by the official Markdown syntax description is an optional feature, as some types of renderers would not know what to do with HTML nodes in the document tree. It must be enabled explicitly:
The methods
withSpanDirectives
andwithBlockDirectives
allow to register custom tags which will be processed by the parser in addition to standard Markdown markup. For more details on directives see laika.directives.Directives.To switch this feature off alongside other custom extensions like configuration sections at the start of the document or automatic id generation for headers, you can run the parser in strict mode: