Laika is a customizable and extensible toolkit for transforming lightweight text markup and template based site generation.
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. using Laika's sbt plugin to produce the project's documentation)
Laika does not require the installation of any external tools.
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.12 and 2.11.
The sbt plugin is published to the sbt plugin repository for sbt 1.x.
If you still need to work with sbt 0.13 and/or Scala 2.10 you need to stay on Laika 0.7.0 which had been the final release supporting those versions.
Add the plugin to
addSbtPlugin("org.planet42" % "laika-sbt" % "0.7.5")
Enable the plugin in your project's
Add Markdown, reStructuredText or HTML template files to
src/docs in your
project and run the
laikaSite task from within sbt to generate the site
Adding the Laika dependency to your sbt build:
libraryDependencies += "org.planet42" %% "laika-core" % "0.7.5"
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"
Example for transforming an entire directory of markup files to a single PDF file:
Transform from Markdown to PDF fromDirectory "src" toFile "hello.pdf"
When using Laika's PDF support you need to add one more dependency to your build:
libraryDependencies += "org.planet42" %% "laika-pdf" % "0.7.5"
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, PDF, XSL-FO 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
Support for styling of PDF documents with CSS
sbt plugin, exposing all Laika features and customization hooks as sbt settings and tasks
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 1,000 tests
Improved performance through redesigning the core parsers (0.8)
New API for ExtensionBundles and support for GitHub Flavored Markdown (0.9)
Support for output in the epub format (0.10)
Integrated support for syntax highlighting in source code (0.11)
API polishing (1.0)
0.7.5 (Dec 30, 2017):
0.7.0 (April 17, 2017):
Cursortype for tree rewriting
FopFactoryfor the PDF renderer (in API and sbt plugin)
laika:sitetask in the sbt plugin that executed several sub-tasks twice which could lead to IllegalStateExceptions caused by the resulting race condition
0.6.0 (May 23, 2016):
prettyPrintfor rendering a single output format
generatefor rendering one or more output formats (e.g.
laika:generate html pdf)
laika:sitevia new setting
TransformAPI to allow for the merging of an entire directory of input files into a single output file (as required by PDF rendering)
0.5.1 (Oct 10, 2015):
0.5.0 (Jan 9, 2014):
0.4.0 (Nov 22, 2013):
0.3.0 (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.0 (May 7, 2013):
0.1.0 (Jan 12, 2013):