markdown_hero
A Python library for processing Markdown — cleanup, chunking, Word (.docx) export, concatenation, splitting by delimiters, and validation.
Compatible with Python 3.10+. Target dialect: GitHub Flavored Markdown (GFM).
Installation
pip install markdown_hero
# with a real tokenizer (tiktoken) for accurate chunking:
pip install "markdown_hero[tokenizers]"
Main functions
| Function | What it does |
|---|---|
strip(md, ...) |
Reduces Markdown to normalized plain text (no diacritics, no punctuation, lowercase). |
extract_chunks(md, purpose=...) |
Splits the document respecting heading hierarchy, with rich metadata. |
word_format(md, output) |
Exports to .docx with a fixed set of professional styles. |
markdown_append(*paths, output) |
Concatenates files with heading shift and frontmatter merge. |
markdown_break(path, delimiter, ...) |
Splits a file into N+1 parts. Accepts string, regex, or list. |
markdown_merge(*paths, output) |
Smart append with section dedupe and TOC generation. |
extract_* |
Frontmatter, links, images, tables, code blocks, headings, TOC. |
lint(md) |
Detects skipped headings, duplicate anchors, unclosed fences. |
CLI markdown-hero |
Command-line access. |
See docs/reference.md for the full technical reference and
docs/helpers.md for the index of internal utilities.
Quick example
from markdown_hero import strip, extract_chunks, word_format
text = "**Hello!** See [docs](https://x). p=2 captures both."
print(strip(text))
# "hello see docs p2 captures both"
chunks = extract_chunks(open("doc.md").read(), purpose="rag", max_tokens=512)
word_format("doc.md", "doc.docx")
CLI
markdown-hero strip doc.md -o doc.txt
markdown-hero chunk doc.md --purpose rag --max-tokens 512 -o chunks.json
markdown-hero word doc.md -o doc.docx
markdown-hero append a.md b.md -o merged.md
markdown-hero break doc.md "---" --output-dir parts/
markdown-hero lint doc.md
Documentation
- Technical reference:
docs/reference.md - Internal helpers index:
docs/helpers.md - Release history:
CHANGELOG.md - How to contribute:
CONTRIBUTING.md - Security policy:
SECURITY.md
Contact
Questions, suggestions, and reports:
- Email: bernardo.leandro@gmail.com
- Always include the prefix
Markdown Hero:in the subject line so the message is routed correctly.
For security vulnerabilities follow the instructions in
SECURITY.md (same email, same subject prefix).
License
MIT © 2026 Bernardo Leandro.
Metadata
Release files for markdown-hero 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| markdown_hero-0.1.0.tar.gz | 44.3 kB | Without provenance | Details for markdown_hero-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| markdown_hero-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for markdown_hero-0.1.0-py3-none-any.whl |
Total release size: 77.5 kB
Release files / markdown_hero-0.1.0.tar.gz
| Download URL | markdown_hero-0.1.0.tar.gz |
|---|---|
| Size | 44.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f8055328e8b7e14f836d46a98907487828a923bf41850c4edd37b8532b3968f
|
|
BLAKE2b-256 checksum How to use checksums |
371d6635115f8f48c57e23a654a28b4680f33b5eb199a069c1d0cf0ece5d2d0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / markdown_hero-0.1.0-py3-none-any.whl
| Download URL | markdown_hero-0.1.0-py3-none-any.whl |
|---|---|
| Size | 33.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dda264221400686c66aa64c7fd75ad9ba9232ad0cb6ef1de18b08c46c57f35ce
|
|
BLAKE2b-256 checksum How to use checksums |
a7a1098da1afc9cd67c06b021368881f2c62cbdf864c6f50533913fac2d28234
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for markdown-hero 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.