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.0rc1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e533390c31c21719a201d4a5a89d4e44d4c0f2cb61cde6dc1f7346a6a098db7a |
|
MD5 | bacbd615993b72008f80bd3cf1a25766 |
|
BLAKE2b-256 | e385716db508656a8aad99ce0dfa5890543fd214119a5eccdf92a8e10acd3274 |
Close
Hashes for pandoc_import_code-1.0.0rc1-py3.8.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc78ece41a44a8453e87945bc6d99d5b8536b2950a9a3211246cf3bcc3f3ecce |
|
MD5 | dbb03733122bbf9a9160d2ff2b14914b |
|
BLAKE2b-256 | 5c70b4eb47f2bb52819d421ecba018c8927d6b179162d76d5aaddf7a9680ab63 |
Close
Hashes for pandoc_import_code-1.0.0rc1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 355712ce1edbd5c9b525a1d5e9cf5b9650b8ce84a896bda60d7081eda21b0eee |
|
MD5 | 9ad1fa912d63c887bd19ee8adfa49594 |
|
BLAKE2b-256 | 0e6d1ea346e32d8c405371614fa2bb86e2abe0e4a98be6a3808fb89a73960095 |