markcraft
Your next Markdown parser in Python: pure Python, CommonMark-oriented, and easy to extend.
Why You Will Like It
- Pure Python, no C extension burden: simpler deployment across environments.
- CommonMark-oriented behavior: predictable parsing with stable token precedence.
- Extensible architecture: add custom block/span tokens and custom renderers.
- More than HTML output: ships with HTML, LaTeX, AST, and Markdown renderers.
- Built for maintainability: parser and renderer responsibilities stay cleanly separated.
Installation
Install from PyPI:
pip install markcraft
Local development setup (uv + Python 3.13):
git clone https://github.com/niu2x/markcraft.git
cd markcraft
uv sync
30-Second Quick Start
1) Render to HTML by default
import markcraft
with open("example.md", "r", encoding="utf-8") as fin:
html = markcraft.render(fin)
2) Use a specific renderer (for example, LaTeX)
import markcraft
from markcraft.renderers import LaTeXRenderer
with open("example.md", "r", encoding="utf-8") as fin:
latex = markcraft.render(fin, LaTeXRenderer)
3) Parse explicitly when you need a Document tree
import markcraft
from markcraft.renderers import MarkdownRenderer
doc = markcraft.parse("a\n\n[b]: /uri\n")
with MarkdownRenderer() as renderer:
renderer_specific_doc = markcraft.parse("a\n\n[b]: /uri\n", renderer)
markdown = renderer.render(renderer_specific_doc)
Why call markcraft.parse(...) twice here?
doc = markcraft.parse(...)uses the default parser path and returns a genericDocumenttree.markcraft.parse(..., renderer)parses with renderer context, so renderer-specific token rules are included when needed.- Use the first form for renderer-agnostic analysis; use the second form when your renderer adds or depends on extra syntax.
Outputs and Extensions
Core renderers
markcraft.renderers.HtmlRenderermarkcraft.renderers.LaTeXRenderermarkcraft.renderers.AstRenderermarkcraft.renderers.MarkdownRenderer
Extension renderers
Import directly from extension modules:
markcraft.extensions.mathjax.MathJaxRenderermarkcraft.extensions.pygments_renderer.PygmentsRenderermarkcraft.extensions.toc_renderer.TocRenderermarkcraft.extensions.github_wiki.GithubWikiRenderermarkcraft.extensions.jira_renderer.JiraRenderermarkcraft.extensions.xwiki20_renderer.XWiki20Renderermarkcraft.extensions.scheme.SchemeRenderer
Or import from the aggregated namespace:
markcraft.renderers.extensions.GithubWikiRenderermarkcraft.renderers.extensions.JiraRenderermarkcraft.renderers.extensions.MathJaxRenderermarkcraft.renderers.extensions.PygmentsRenderermarkcraft.renderers.extensions.SchemeRenderermarkcraft.renderers.extensions.TocRenderermarkcraft.renderers.extensions.XWiki20Renderer
For Contributors
Use uv and Python 3.13 for local development.
uv sync
uv run pytest
For benchmarks:
uv sync --group benchmark
uv run python tests/benchmark.py
More implementation details: DEVELOPMENT.md and BENCHMARKING.md.
Contributing
Issues, discussions, and pull requests are welcome.
- For larger changes, open an issue first with context and a minimal reproduction.
- Keep code contributions focused and add tests under
tests/.
Versioning and License
- Licensed under MIT. See
LICENSE.
Project Links
- Repository: https://github.com/niu2x/markcraft
- Issues: https://github.com/niu2x/markcraft/issues
- Actions: https://github.com/niu2x/markcraft/actions
- PyPI: https://pypi.org/project/markcraft/
Metadata
Release files for markcraft 1.0.3
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 |
|---|---|---|---|---|
| markcraft-1.0.3.tar.gz | 39.9 kB | With provenance | Details for markcraft-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| markcraft-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for markcraft-1.0.3-py3-none-any.whl |
Total release size: 96.5 kB
Release files / markcraft-1.0.3.tar.gz
| Download URL | markcraft-1.0.3.tar.gz |
|---|---|
| Size | 39.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b68bfeb435545a6e1e076fffabec6c068e948c72e36488c87f6b212838504ac
|
|
BLAKE2b-256 checksum How to use checksums |
b00f06e1c7f4f3703c12f474d68b45d85bafa4eb14bb3c3118c27d9475b954e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / markcraft-1.0.3-py3-none-any.whl
| Download URL | markcraft-1.0.3-py3-none-any.whl |
|---|---|
| Size | 56.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8bb186af108f1a4a6bbfaede13af4081777fba5525157cbef3048bb56f4fd066
|
|
BLAKE2b-256 checksum How to use checksums |
a4eb91c6597f9b1948da09580b84f6a07f83535f8de9a3e52b4bae780e904df0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logSecurity for markcraft 1.0.3
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for markcraft-1.0.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logA 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.