earldouglas / sbt-lit   0.0.5

ISC License GitHub

Literate programming with sbt

Scala versions: 2.12
sbt plugins: 1.0

Build status Latest version


  • sbt 1.1.0+
  • Scala 2.10.2+

Getting started

Add the sbt-lit plugin to your project:


addSbtPlugin("com.earldouglas" % "sbt-lit" % "0.0.5")

Write some literate code:


# "Hello, world!" in Scala

This is a short example of literate programming in Scala.  This Markdown
file contains Scala snippets that, when collected, compile to a working

The code in this file lives in the `example` package:

package example

The greeting will come from a source of static strings:

import example.data.Strings

The `HelloWorld` object extends the `App` trait, making it runnable by a
built-in `main` method:

object HelloWorld extends App {


# Strings

This file contains static strings to be used within the application.
Note how we can mix Scala code in HelloWorld.md with Java code here.

This code lives in the `example.data` package:

package example.data;

The `Strings` object provides access to the static strings:

public class Strings {
  public static String helloWorld = "Hello, world";

Build and run it:

$ sbt
> compile
> run
Hello, world!


  • litSource - source directory for literate files
    • Type: File
    • Default: litSource := (sourceDirectory in Compile).value / "lit" (src/main/lit)
  • litLangs - languages to extract from literate files
    • Type: Seq[File]
    • Default: litLangs := Seq("scala", "java")