myform: Universal Docs-Format Translation#
myform reads MyST Markdown, GitHub Flavored Markdown, Obsidian-Flavored Markdown, Sphinx
reStructuredText, Typst, and the Plane dialect into one typed document tree, then writes that
tree as any of those formats or as a bounded MediaWiki wikitext subset.
Formatting is the identity case of the same conversion pipeline.
The original opinionated MyST mdformat plugin remains available as a compatible facade.
Install or develop#
Install the current public release from PyPI:
pip install myform
From a checkout, install the development environment and inspect the CLI with:
uv sync --all-extras
uv run myform --help
Translate and format#
uv run myform convert guide.md --from myst --to rst -o guide.rst
printf '# Hello\n' | uv run myform convert - --from gfm --to typst
uv run myform convert guide.md --from myst --to wikitext -o guide.wiki
uv run myform format README.md --format myst
Input - means stdin.
Document output uses stdout unless -o/--output names a file, while --report summary|json|none controls conversion reporting on stderr.
Wikitext is currently a write-only bounded target: unsupported source constructs are carried or approximated with a conversion report, never silently called native. Its reader remains gated on the separate public Wikiparse release.
Configuration is discovered upward from the target path.
Use myform.yaml, .myform.yaml, or [tool.myform] in pyproject.toml to select degradation policy, opt into assist, configure target writers, or load trusted extensions.
The committed myform.schema.json describes this surface; assist is degradation-only, disabled by default, and has a deterministic fallback.
Without a myform config, a myst format identity takes the mdformat facade and honors a discovered .mdformat.toml (nearest file wins) the way the mdformat CLI does: core facade options, plugin tables, and exclude pass-through.
Carrier-aware extensions call myform.convert_artifact(...). The returned artifact keeps target
text, its degradation report, and deterministic typed enclave records together; legacy conversion
shapes raise rather than discard a carrier.
Documentation#
Package reference
- 1. API Reference
- 1. The Mdformat Plugin Entry Point
- 2. Typed configuration schema for the MyST plugin
- 3. Reusable In-Process Conversion Sessions
- 4. The Typed Document Model (nodes, token bridge, and traversal)
- 5. Format Readers (source text -> typed Doc)
- 6. Format Writers (typed Doc -> target text)
- 7. The Degradation Engine (capability-driven lowering, annotate + report)
- 8. Collections (N documents, and the references between them)
- 9. Markdown Dialect Plugins (markdown-it rules + mdformat renderers)
- 10. The Assist Seam (opt-in, degrade-only LM suggestions)
- 11. The Configuration Layer (``myform.yaml`` + ``[tool.myform]`` + ``.py`` extensions)
- 12. Command-line interface for translating and formatting documents with ``myform``
- 13. MyST Markdown to AST Parsing
- 14. AST to MyST Markdown Rendering
- 15. Rendered Markdown Text Postprocessing
- 16. Fold-aware Markdown table rendering
- 17. Semantic Line Break (SemBr) Paragraph Reflow
- 18. Skip-formatting ("ignore") comments -- the mdformat #53 gap, filled for MyST
- 19. Declarative Inter-Block Spacing Policies
- 20. Shared safe-Setext policy for CommonMark-family readers
- 21. Markdown-It Rule Ordering Tables
- 22. Regex and Registration Utilities