davegurnell / spandoc

Write Pandoc filters in Scala.

Version Matrix


Write Pandoc filters in Scala. Very early release. Still in development.

Copyright 2016 Dave Gurnell. Licensed Apache 2.

Build Status Coverage status Maven Central

Getting Started

Grab this library in an Ammonite script and use it with Pandoc's --filter parameter. Here's an example script:

// Filename: filter.scala
#!/usr/bin/env amm

import ammonite.repl._

interp.load.ivy("com.davegurnell" %% "spandoc" % "<<VERSION>>")


import spandoc._

// Define a transform. This one only transforms "inline" elements:
val uppercase = transofrm.TopDown.inline {
  case Str(str) =>

// Run the transform on stdin, printing the result to stdout:

Then run Pandoc using the --filter option to point to filter.scala:

bash$ echo 'Lorem ipsum' | pandoc --to=html --filter=./filter.scala