All work

myForm

Translates between document formats through one typed document tree.

Source on GitLab Python · MPL-2.0 · v0.7.0
Isometric path of a document through myform, from the readers at the back left to the writers at the front right. Seven formats are both read and written: gfm, myst, obsidian, plane, rst, typst, wikitext. Between the one typed document tree, which has 39 node classes, and every writer stands the degrade layer, a tall cyan wall. Where a writer cannot express a construct, the layer reports one of four actions: approximated, replaced, dropped or enclosed. Height is lines of Python in the subsystem: readers 2,585, tree 1,990, degrade 4,314 and writers 2,993, so degrade is the heaviest. A real conversion of one myst document to gfm reported 2 approximated and 4 replaced changes. readers 2,585 tree 1,990 degrade 4,314 writers 2,993 approximated replaced dropped enclosed read and written: gfm myst obsidian plane rst typst wikitext myst to gfm: 2 approximated, 4 replaced height = lines of code

myForm reads and writes six document formats (MyST Markdown, GitHub Markdown, Obsidian Markdown, reStructuredText, Typst, and a subset of wikitext) through one typed document tree. Formatting a file in place is just the identity case of conversion.

When the target can't represent something, myForm approximates or replaces it, leaves a provenance comment where the format allows one, and records every change in a conversion report instead of dropping it quietly. It started as a rewrite of mdformat-myst and is on PyPI, with a Rust-backed Typst reader.

Six document formats (MyST, GFM, Obsidian, reStructuredText, Typst, wikitext) each read into and write out of one central typed document tree, so any format converts to any other. A MyST document travels into the tree and out as reStructuredText. Doc MyST GFM Obsidian reST Typst wikitext
A MyST document containing a note directive is read into a typed tree. The Directive node is then written by four writers: reStructuredText keeps it as a native note with no degradation; GFM approximates it as a NOTE alert; Typst approximates it as a block quote; wikitext replaces it with plain blocks and leaves a provenance comment. The outputs are real myForm output. MyST source Typed tree Writers # Field Guide Seen at **dawn**. ```{note} Bring binoculars. ``` Root Heading · 1 Paragraph Strong Directive · note Paragraph reST no degradation .. note:: Bring binoculars. GFM approximated > [!NOTE] > > Bring binoculars. Typst approximated #quote(block: true)[ *Note* Bring binoculars. ] wikitext replaced <!-- myform: replaced … '''Directive: note''' Bring binoculars. Conversion reports myform: rst: no degradation. myform: gfm: 1 change (1 approximated). myform: typst: 1 change (1 approximated). myform: wikitext: 1 change (1 replaced).