Registry / data / panflute

panflute

JSON →
library2.3.1pypypi✓ verified 91d ago

Panflute is a Pythonic library for writing Pandoc filters. It provides an easy-to-use API to traverse and modify the Pandoc AST. Current version is 2.3.1, compatible with Python >=3.7 and Pandoc 3.1.x. Releases follow Pandoc API updates.

pip install panflute
INSTALL
IMPORT
SIG · PANFLUTE
P
panflute
datapythonv2.3.1
Install
1.7s avg
Import
236ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.240s · 21MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.232s · 22MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

run_filter
✓ import panflute as pf
✗ from panflute import run_filter
run_filter is not a top-level function; use pf.run_filter or from panflute.tools import run_filter
Header
✓ from panflute import Header
✗ from panflute.elements import Header
Header is available directly from panflute

Basic Pandoc filter to uppercase all headers. Run with pandoc: pandoc input.md --filter script.py -o output.md

import panflute as pf def capitalize_headers(elem, doc): if isinstance(elem, pf.Header): return pf.Header(pf.stringify(elem).upper(), level=elem.level) if __name__ == '__main__': pf.run_filter(capitalize_headers)
Debug
Known issues
breakingNull block element removed in version 2.3.0. Filters relying on Null must be updated.
fix
Replace references to pf.Null with appropriate handling (e.g., skip or convert to pf.Plain).
affects: >=2.3.0
breakingFigure block element added in version 2.3.0. Pandoc 3.0+ required, older pandoc versions incompatible.
fix
Ensure pandoc version is 3.0+ when using panflute 2.3.0+.
affects: >=2.3.0
deprecatedThe run_filter function is deprecated in favor of run_pandoc or direct usage of the returned document.
fix
Use pf.run_pandoc() with a filter function for better control.
affects: <3.0 (future)
gotchaTable caption handling: In Panflute 2.1.4+, Table() allows no caption. Older versions might crash with None caption.
fix
Update panflute or always provide a caption string.
affects: <2.1.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'panflute'
Panflute not installed.
fix
Run pip install panflute
pandoc: panflute: /usr/bin/env: 'python': No such file or directory
Pandoc filter script shebang line missing or wrong Python path.
fix
Add shebang #!/usr/bin/env python3 and ensure the script is executable.
Upgrade
Version history
2.3.1latest on PyPI · released Mar 20, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
panflute — pip install panflute · libregistry