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
⚠️ pandoc-import-code requires Pandoc 2.11+, as it relies on Panflute 2
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
Metadata
Release files for pandoc-import-code 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pandoc-import-code-1.0.0.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pandoc_import_code-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / pandoc-import-code-1.0.0.tar.gz
| Download URL | pandoc-import-code-1.0.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f02eb81a264d3e861fd177bb054d9bec88549747888f78d2bbdfb9aa7702599
|
|
BLAKE2b-256 checksum How to use checksums |
b22408acfc9d0c4796cd0fe7554f2ccce5ecbabdc9b520c8d6dad27aa6720013
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.6
|
Release files / pandoc_import_code-1.0.0-py3-none-any.whl
| Download URL | pandoc_import_code-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74d25638553a0dccb348ac748b4cf27d9f710c22da57ab5e09ef9cdc778447ba
|
|
BLAKE2b-256 checksum How to use checksums |
b732ab21a9a32966a6337791150da7cc15c5e91c82af059869149c755f03f581
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.6
|