# The pandoc-include package

[ Tags: library, mit, program, text ] [ Propose Tags ]

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

## Properties

Versions 0.0.1 CHANGELOG.md base (>=4.6 && <5), directory, pandoc (>=1.13.0.0), pandoc-types (>=1.12.0.0), text (>=0.11) [details] MIT (c) 2015 Dániel Stein Dániel Stein Dániel Stein Text https://github.com/steindani/pandoc-include https://github.com/steindani/pandoc-include/issues head: git clone git://github.com/steindani/pandoc-include.git Tue Dec 8 13:55:44 UTC 2015 by steindani NixOS:0.0.1 pandoc-include 362 total (45 in the last 30 days) (no votes yet) [estimated by rule of succession] λ λ λ Docs not available Last success reported on 2016-11-29 Hackage Matrix CI

#### Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]

# pandoc-include

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: http://pandoc.org/scripting.html#include-files

## Format

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.

include
/absolute/file/path.md
relative/to/the/command/root.md
#do/not/include/this.md



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.

## Installation

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.

## Usage

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 input.md


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 input.md | runhaskell IncludeFilter.hs | pandoc --from json --to latex