pandoc-include: Include other Markdown files

[ library, mit, program, text ] [ Propose Tags ]
Versions 0.0.1
Change log
Dependencies base (>=4.6 && <5), directory, pandoc (>=, pandoc‑types (>=, text (>=0.11) [details]
License MIT
Copyright (c) 2015 Dániel Stein
Author Dániel Stein <>
Maintainer Dániel Stein <>
Category Text
Home page
Bug tracker
Source repo head: git clone git://
Uploaded by steindani at Tue Dec 8 13:55:44 UTC 2015
Distributions NixOS:0.0.1
Executables pandoc-include
Downloads 536 total (23 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2016-11-29 [all 3 reports]
Hackage Matrix CI

A Pandoc filter that replaces include labeled Code Blocks with the contents of the referenced Markdown files. Even nested, recursive includes.

[Skip to Readme]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for pandoc-include-0.0.1

[back to package description]


A Pandoc filter that replaces include labeled Code Blocks with the contents of the referenced files. Even nested, recursive includes.

Based on the scripting tutorial for Pandoc:


The Code Blocks like the following will include every file in a new line. The reference paths should be either absolute or relative to the folder where the pandoc command will be executed.


If the file does not exist, it will be skipped completely. No warnings, no residue, nothing. Putting an # as the first character in the line will make the filter skip that file.

For now the nested includes only work for two levels, after that the source will be inserted and not parsed.

Note: the metadata from the included source files are discarded.


One could either install it using the Cabal packaging system by running:

cabal update
cabal install pandoc-include

Or it is also possible to use the pipe method using the source code described in the Usage section.


In order to use this Pandoc filter, one has to include it into the Pandoc transformation workflow. This can be done by using the --filter parameter, like so:

pandoc --from markdown --to latex --filter pandoc-include

All this does in the background is pipelining the output of Pandoc and the last filter into the standard input of the include filter and using its output as the next filter's input:

pandoc --from markdown --to json | runhaskell IncludeFilter.hs | pandoc --from json --to latex


Copyright ©2015 Dániel Stein

Source code is released under the Terms and Conditions of MIT License.