You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Peter J. Jones 39182cd3c5 Style-only change 4 years ago
src/Text SpecialComments no longer looks at file extensions 5 years ago
test New FileList parser that can handle comments anywhere, even just before EOF 5 years ago
util @ 713ac78abe Updated the cabal file, added the --version option 4 years ago
.gitignore Add some ignores for cabal sandbox 5 years ago
.gitmodules Changes to almost build with GHC 7.8.x, waiting on pandoc 5 years ago
GNUmakefile Updated the cabal file, added the --version option 4 years ago Fix license file 5 years ago Documentation-only changes 5 years ago Initial package and code 6 years ago
devalot-pandoc.cabal Used the correct functions for setting a default --delimiter value 4 years ago
devalot-pandoc.hs Style-only change 4 years ago

Pandoc Extensions for

The devalot-pandoc package can either be used as a Haskell library or through the devalot-pandoc executable. The devalot-pandoc executable can act in a few different “modes”, the primary one being a Pandoc JSON filter. See the output of devalot-pandoc --help for more information.

I use this package to build, write presentations, and author books. The most recent of which is the forthcoming Effective Ruby book, published by Addison-Wesley.


Inserting Code from External Files

Using fenced code blocks you can insert code from an external file into your markdown document. This is done by using the include key in the fenced code block attribute section:

~~~ {.ruby include="path/to/somefile.rb"}

Placing the above in your markdown file will instruct devalot-pandoc to insert the contents of the path/to/somefile.rb file into the document, replacing the existing fenced code block. Furthermore, it’s possible to narrow what gets inserted using delimiters in the source code. For example, consider this version of somefile.rb:


class Foo
  # <<: cut
  def initialize
    @foo =
  # :>>

Notice the commented delimiters :>> cut and <<:? You can ask devalot-pandoc to only insert code from somefile.rb which is between those delimiters using the token attribute:

~~~ {.ruby include="path/to/somefile.rb" token="cut"}

Executing Commands and Inserting Their Output

Using fenced code blocks and the exec attribute you can execute arbitrary commands and insert their output into the document, replacing the original fenced code block. The contents of the existing fenced code block are used as the STDIN for the command:

~~~ {exec="date"}

~~~ {exec="sh -"}
cd /some/path
ls -l

Experimental Features

There are other experimental features that you’ll need to read the source code to use:

  • A parser that reads configuration files that include a list of markdown file names.

  • The ability to read the configuration files mentioned above and stitch all of the listed markdown files into a single markdown file. This is useful for combining the chapters of a book into a single file, for example.

  • Process source files and replace specially formatted comments with other text. I use this to replace # ... with Unicode ellipses.