{"id":21678,"library":"panflute","title":"Panflute","description":"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.","status":"active","version":"2.3.1","language":"python","source_language":"en","source_url":"https://github.com/sergiocorreia/panflute","tags":["pandoc","filter","ast","markdown","document-conversion"],"install":[{"cmd":"pip install panflute","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"run_filter is not a top-level function; use pf.run_filter or from panflute.tools import run_filter","wrong":"from panflute import run_filter","symbol":"run_filter","correct":"import panflute as pf"},{"note":"Header is available directly from panflute","wrong":"from panflute.elements import Header","symbol":"Header","correct":"from panflute import Header"}],"quickstart":{"code":"import panflute as pf\n\ndef capitalize_headers(elem, doc):\n    if isinstance(elem, pf.Header):\n        return pf.Header(pf.stringify(elem).upper(), level=elem.level)\n\nif __name__ == '__main__':\n    pf.run_filter(capitalize_headers)","lang":"python","description":"Basic Pandoc filter to uppercase all headers. Run with pandoc: pandoc input.md --filter script.py -o output.md"},"warnings":[{"fix":"Replace references to pf.Null with appropriate handling (e.g., skip or convert to pf.Plain).","message":"Null block element removed in version 2.3.0. Filters relying on Null must be updated.","severity":"breaking","affected_versions":">=2.3.0"},{"fix":"Ensure pandoc version is 3.0+ when using panflute 2.3.0+.","message":"Figure block element added in version 2.3.0. Pandoc 3.0+ required, older pandoc versions incompatible.","severity":"breaking","affected_versions":">=2.3.0"},{"fix":"Use pf.run_pandoc() with a filter function for better control.","message":"The run_filter function is deprecated in favor of run_pandoc or direct usage of the returned document.","severity":"deprecated","affected_versions":"<3.0 (future)"},{"fix":"Update panflute or always provide a caption string.","message":"Table caption handling: In Panflute 2.1.4+, Table() allows no caption. Older versions might crash with None caption.","severity":"gotcha","affected_versions":"<2.1.4"}],"env_vars":null,"search_vec":"'2.3.1':29 '3.1':36 '3.7':33 'api':18,41 'ast':25,45 'compat':30 'convers':49 'current':26 'document':48 'document-convers':47 'easi':15 'easy-to-us':14 'filter':10,44 'follow':39 'librari':6 'markdown':46 'modifi':22 'pandoc':9,24,35,40,43 'panflut':1,2 'provid':12 'python':5,32 'releas':38 'travers':20 'updat':42 'use':17 'version':27 'write':8 'x':37","created_at":"2026-04-27T17:01:10.232119+00:00","updated_at":"2026-04-27T17:01:10.232119+00:00","problems":[{"fix":"Run pip install panflute","cause":"Panflute not installed.","error":"ModuleNotFoundError: No module named 'panflute'"},{"fix":"Add shebang #!/usr/bin/env python3 and ensure the script is executable.","cause":"Pandoc filter script shebang line missing or wrong Python path.","error":"pandoc: panflute: /usr/bin/env: 'python': No such file or directory"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.3.1","cli_name":"","cli_version":null,"type":"library","homepage":"http://scorreia.com/software/panflute/","github":"https://github.com/sergiocorreia/panflute","docs":"http://scorreia.com/software/panflute/","changelog":null,"pypi":"https://pypi.org/project/panflute/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-29","install_tag":null}}