parse-mw
Bounded, source-preserving MediaWiki parsing and safe typed HTML rendering. Python 3.14+, with no runtime dependencies.
python -m pip install parse-mw
from parse_mw import parse, render
document = parse("== Heading ==\n\nHello '''bold''' [[Target|label]].")
assert document.to_mediawiki().startswith("== Heading ==")
assert "<strong>bold</strong>" in document.to_html()
result = render("{{Infobox|name=Example}}\n\n{| class=\"wikitable\"\n|-\n! A !! B\n|-\n| 1 || 2\n|}")
assert "<table>" in result.html
The parser preserves original source text and half-open code-point spans. Documents and fragments expose immutable dataclass nodes for text, sections, headings, lists, templates, tables, links, references, categories and MediaWiki literal constructs. Unknown syntax remains source-preserving text.
HTML is escaped by default. RendererContext(trust="trusted") permits explicit
raw tags, but it is not sanitization. Links, file URLs and custom node output
are handled through caller-owned callbacks.
See the API contract. Defaults are 2,000,000 characters, 100,000 nodes and 64 nesting levels; limits fail explicitly with diagnostics and never return partial documents.
Development and distribution qualification:
uv sync --locked
uv run --frozen python -m pytest
uv run --frozen python scripts/check_distribution.py --output-dir /tmp/parse-mw-candidate
release.yaml uses the pypi environment and verifies tag/version/main before
publication through Trusted Publishing.
Metadata
Release files for parse-mw 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 |
|---|---|---|---|---|
| parse_mw-0.1.0.tar.gz | 18.7 kB | With provenance | Details for parse_mw-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| parse_mw-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for parse_mw-0.1.0-py3-none-any.whl |
Total release size: 32.2 kB
Release files / parse_mw-0.1.0.tar.gz
| Download URL | parse_mw-0.1.0.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccb957f0fb7230b019ca38c62c3fb58e2f2ad057496e00e464686783e6271e07
|
|
BLAKE2b-256 checksum How to use checksums |
a484716cb353b25074f0075bd523f3c019cf8ddcd1130faf449a7dff7599328f
|
| 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 Nov 22, 2026.
Transparency logRelease files / parse_mw-0.1.0-py3-none-any.whl
| Download URL | parse_mw-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c0b047d6c929375bbe0bed3cfd1e0d713611a641df540e474caaedb5c78127c
|
|
BLAKE2b-256 checksum How to use checksums |
2d70f8748ab21b1cd28727da8d5b2dcab5581476af19cfe09f083bd5782b27b0
|
| 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 Nov 22, 2026.
Transparency logSecurity for parse-mw 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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for parse_mw-0.1.0.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 Nov 22, 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.