Laika is a customizable and extensible toolkit for transforming lightweight markup languages to various types of output formats, written in Scala.
It has been designed for two primary usage scenarios:
Embedded use (e.g. web applications that allow user input in one of the supported markup syntaxes)
As a standalone tool (e.g. as part of an sbt build that produces the project's documentation)
It is Open Source under the Apache 2.0 License.
If you wonder about the name of the project and have never heard about Laika, you can read about her here.
The current version is published to Maven Central for Scala 2.10.x, 2.9.3 and 2.9.2.
Adding Laika to your project with sbt:
libraryDependencies += "org.planet42" %% "laika" % "0.4.0"
Example for transforming from file to file:
Transform from Markdown to HTML fromFile "hello.md" toFile "hello.html"
Example for transforming an entire directory of markup files:
Transform from ReStructuredText to HTML fromDirectory "source" toDirectory "target"
For further information:
Read more about standard usage in the chapter Transformation Basics.
Try out Laika with the Web Tool.
Browse the source on GitHub.
Browse the API.
Follow on Twitter for release announcements.
Create Issues here on GitHub for bug reports or enhancement requests.
Ask questions on Stackoverflow, tagging with Laika and Scala.
There will also be a dedicated forum in case of growing interest in Laika.
This manual is written in Markdown and transformed by Laika. Its source
is included in the repository inside the
Support for Markdown and reStructuredText as input
Support for HTML and PrettyPrint (for debugging) as output
Template-based Site Generation
Support for tables of contents, convenient cross-linking between documents and auto-numbering of documents and sections for all supported markup formats
Custom Directives (tags) for templates and text markup, with type-safe and concise DSL for their declaration
Customization hooks for renderers (based on simple partial functions that change the output for specific node types)
Document Tree Rewriting (hooks for modifying the document AST, consisting of case classes, between parsing and rendering, based on simple partial functions)
Simple contracts and APIs for adding new parsers and renderers
A set of generic and fast parser combinators for common tasks in markup parsing that are not based on the commonly used (and often slow) regex parsers
Various options for input and output (strings, files, java.io.Reader/Writer, java.io streams)
Parallel processing of parsers and renderers
More than 900 tests
sbt Plugin (0.5)
New renderers for DocBook and PDF (0.6)
New renderer for epub (0.7)
After these three releases priorities depend on user demand, therefore no specific order has been set for these other ideas:
Various Markdown extensions (GitHub Flavored Markdown, Multimarkdown, etc.)
Integrated support for syntax highlighting in source code blocks
AsciiDoc support (gets requested occasionally)
A Java API
A command line interface
0.4 (Nov 22, 2013):
0.3 (Aug 3, 2013):
rawand many more)
HTML.unformattedfor terse output without indentation or whitespace (often desirable when writing the rendered document to a database for example)
0.2 (May 7, 2013):
0.1 (Jan 12, 2013):