Yet another pandoc filter to include external code files.
Project description
Pandoc-import-code
Pandoc filter to include external code files as fenced code blocks using the Vuepress syntax.
Install
To install pandoc-import-code, open the command line and type:
pip install pandoc-import-code
Python 3.6+ and PyPy3 are supported.
Usage
Command
$ pandoc source.md --filter pandoc-import-code -o output.md
Syntax
<<< @/<path>#[region]
- path : path to a code file to import
- relative to the pandoc command working directory
- region : custom region name for partial import
- syntax inspired by VS Code
Example
$ pandoc docs/index.md --filter pandoc-import-code -o out.md
Source (./docs/index.md
)
# Code Sample
<<< @/samples/hello-world.html#title
Code sample (./samples/hello-world.html
)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<!-- #region title -->
<h1>
Hello World!
</h1>
<!-- #endregion title -->
</body>
</html>
Output (./out.md
)
# Code Sample
``` {.html}
<h1>
Hello World
</h1>
```
Limitations
- as line-highlighting isn't supported by pandoc, any
{1-2}
parameter will be ignored
Dev Install
After cloning the repository and opening the pandoc-import-code folder:
python setup.py install
: installs the package locally
python setup.py develop
: installs locally with a symlink so changes are
automatically updated
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for pandoc-import-code-1.0.0rc2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cd406913254fae832e432b74daf72252760e760264ebf3e444d574ab487d8eb |
|
MD5 | 94fa974a11af38b7efe95755920cb439 |
|
BLAKE2b-256 | f4263939be30063dad48caba1ae3f4162359dcba9c6014532a95dcc88b2485c6 |
Close
Hashes for pandoc_import_code-1.0.0rc2-py3.8.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1244c990abbaf58d6c66bd1d7cbaaf0c1cd85aa1fdf0c1dc9ce3ee7f721f0a11 |
|
MD5 | aa8def2c14f96ccfacacce8cc117e27d |
|
BLAKE2b-256 | bee92a2a4dddb60b39478a4fda2b4ecac0002a7b383783fb32b4df58917882e8 |
Close
Hashes for pandoc_import_code-1.0.0rc2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60fdee3a85567b666fe831099fd1270f33d4f93c86e2eecc2a4d68d9375baafc |
|
MD5 | 8e8503c0d5e8b005aebd1dee317f8d8d |
|
BLAKE2b-256 | 65f3e3ad915a3b4eece838774aa56ade4b9fa65e1a00048e5969ce91ef432625 |