On this page
parse-mw
Prev: parse-html5 | Up: projects | Next: parse-xml1
Rel: wispsy, Foundation, parse-md
Ref: wispsy on GitHub
Tags: #public #wispsy #project #foundation #tier/specialized
Role
Bounded, source-preserving MediaWiki parsing (parse) and safe typed HTML rendering (render) for Python 3.14+ (0.1.0, zero runtime deps)—modeling headings, sections, lists, templates, tables, links, references, and categories as immutable dataclass nodes.
Install
python -m pip install parse-mw
Quickstart
from parse_mw import parse, render
doc = parse("== Heading ==\n\nHello '''bold''' [[Target|label]].")
assert doc.to_mediawiki().startswith("== Heading ==")
assert "<strong>bold</strong>" in doc.to_html()
result = render("{| class=\"wikitable\"\n|-\n! A !! B\n|-\n| 1 || 2\n|}")
assert "<table>" in result.html
When to Reach for It
- Ingesting or converting MediaWiki markup (such as Wikipedia dumps) with strict character/node/depth bounds and caller-owned link/file callbacks.
Gotchas & Pitfalls
- No live Wikipedia template expansion:
parse-mwmodels MediaWiki templates, links, and categories as immutable AST nodes without fetching external template definitions. - Strict dump bounds: Large Wikipedia XML dumps must be chunked per article within the configured character, node, and nesting depth limits.
- Caller-owned link/file callbacks: Custom
[[File:...]]and internal wiki links require caller callbacks duringrender()to map into final URLs.
Pairs With
- hypnosis — Uses
parse-mw==0.1.0in its[data]and[training]profiles for MediaWiki excerpts. - parse-md & parse-html5 — Sibling bounded markup parsers.
Metadata
type: project-card
slug: parse-mw
org: wispsy
repo: wispsy/parse-mw
package: parse-mw
version: 0.1.0
requires_python: ">=3.14"
layer: foundation
topic: wispsy-foundation
status: active
language: python
source_docs: README.md, docs/
Linked from
Related notes
- wiki/projects/parse-html5 Linked here; links to this page; shared tags: #foundation, #project, #tier, #wispsy
- wiki/projects/parse-xml1 Linked here; links to this page; shared tags: #foundation, #project, #tier, #wispsy
- wiki/stack/foundation Linked here; links to this page; shared tags: #foundation, #tier, #wispsy
- wiki/projects Linked here; links to this page; shared tags: #wispsy
- wiki/projects/parse-md Linked here; shared tags: #foundation, #project, #tier, #wispsy
- wiki/projects/hypnosis Linked here; shared tags: #project, #tier, #wispsy
- wiki/choosing links to this page; shared tags: #tier, #wispsy
- wiki/compatibility links to this page; shared tags: #tier, #wispsy
- wiki/families links to this page; shared tags: #tier, #wispsy
- wiki/orgs/wispsy Linked here; shared tags: #tier, #wispsy