A parser for text written in reStructuredText markup. Instances of this class may be passed directly to the Parseer or Transformer APIs:
val document = MarkupParser.of(ReStructuredText).build.parse(inputString)
Transformer.from(ReStructuredText).to(HTML).build.transform(inputString)
reStructuredText has several types of extension points that are fully supported by Laika. For more information on how to implement and register those see laika.rst.bundle.RstExtensionRegistry.
In addition to the standard reStructuredText directives, the API also supports a custom directive type unique to Laika. They represent a library-wide extension mechanism and allow you to implement tags which can be used in any of the supported markup formats or in templates. If you need this level of flexibility, it is recommended to use the Laika directives, if you want to stay compatible with the reStructuredText reference parser, you should pick the standard directives.
Laika directives can be registered with the laika.directive.DirectiveRegistry extension bundle. The DSLs for creating directives are similar, but still different, due to differences in the feature set of the two variants. The Laika directives try to avoid some of the unnecessary complexities of reStructuredText directives.
Creates the parser for a sequence of blocks based on the parser for a single block.
Creates the parser for a sequence of blocks based on the parser for a single block.
The parser for a single block is already the result of merging all block parsers defined within this instance with all extension parsers defined by the user.
The default implementation simply applies this parser repeatedly while skipping blank lines between the parsed blocks. This method can get overridden for special requirements, for example when the previous result has an influence on which parser to pick for the subsequent block.
The file suffixes recognized by this parser. When transforming entire directories only files with names ending in one of the specified suffixes will be considered.
The file suffixes recognized by this parser. When transforming entire directories only files with names ending in one of the specified suffixes will be considered.
It is recommended not to support txt or similarly common suffixes as this might interfere with other installed formats.