Skip to main content

Pandoc filter to allow file includes

Project description

pandoc-include

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.

Installation

First, install python and python-pip.

Then, use pip to install:

pip install --user pandoc-include

Usage

Command

To use this filter, add to pandoc command

pandoc input.md --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 test.md --filter pandoc-include -o test.pdf

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

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

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

Syntax

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

!include somefolder/somefile

Or

$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/chap01.md

!include chapters/chap02.md

!include chapters/chap03.md

!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.

License

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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pandoc-include-0.4.0.tar.gz.

File metadata

  • Download URL: pandoc-include-0.4.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for pandoc-include-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8fc4d45c88467a53ad092a388df8b784c60d1be1fe4a3e43d8adf9e0294ee05f
MD5 649733e8c8a598bae44d5548785cd5c0
BLAKE2b-256 f6481b6ee24f9db3d16bad8951f27022e5ec138cd7634105009694913cec321d

See more details on using hashes here.

File details

Details for the file pandoc_include-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pandoc_include-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for pandoc_include-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e3d14fc1bfbc9721272bfa28df1dea56ca031304782562c2365e3a41bed870b
MD5 d2ea0cf5c9bb18059dd60834b9d1d1d0
BLAKE2b-256 74b7dcbc9f55cc6d6b4dea208a285e3fd6cb9b9211fdad78d8df3d0acd7321e6

See more details on using hashes here.

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