Skip to main content

Pandoc filter to allow file includes

Project description


Pandoc filter to allow file includes.

The filter script is based on User Guide for Panflute. This repository is to provide a simple way to install and use it.


First, install python and python-pip.

Then, use pip to install:

pip install --user pandoc-include



To use this filter, add to pandoc command

pandoc --filter pandoc-include -o output.pdf

Header option

include-entry: 'path'

The include-entry option is a path relative to current working directory or absolute where the entry file (the initial file) locates. It should be placed in the entry file only, not in the included files. The default include-entry value is ..

For example, to compile a file in current directory, no header is needed:

pandoc --filter pandoc-include -o test.pdf

However to compile a file not in current directory, like:

pandoc dir/ --filter pandoc-include -o test.pdf

The header should now be set to: include-entry: dir.


Each include statement has its own line and has the syntax:

!include somefolder/somefile


$include somefolder/somefile

Each include statement must be in its own paragraph. That is, in its own line and separated by blank lines.

The path can be either absolute or relative to the current file's directory. (If the include statement is in an included file, then the path is relative to the included file itself.) If no extension was given, ".md" is assumed.

For example, it can be used to separate chapters into different files, or include some latex files:

title: Article
author: Author
toc: true

!include chapters/

!include chapters/

!include chapters/

!include data/table.tex

Recursive include is supported from v0.3.1.

Note: The second syntax may lead to wrong highlighting when using a markdown editor. If it happens, use the first syntax.


MIT License

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandoc-include-0.4.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

pandoc_include-0.4.0-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page