Mapping reference

How each construct maps between Markdown and Org, and which normalizations to expect. Terms are defined in CONTEXT.md; the design rationale lives in the ADRs.

Round-trip convergence

Strict byte-losslessness between the two formats is impossible. morg's guarantee is to be semantically faithful and convergent instead (see ADR 0001):

Recorded style (md → org, opt-in)

With recordMarkdownStyle, the markdown style the source was written in is detected and stored as a leading #+MORG_MARKDOWN_STYLE: keyword (JSON on one line), then restored by org → md instead of being canonicalized, which is what makes a consistently non-canonical file a round-trip identity rather than a one-time reformat (ADR 0004). Explicit style options override a record; normalizing drops it, unless it is itself given recordMarkdownStyle, which re-records the canonical form's own markers.

Recorded: bullet, emphasis, strong, fence, rule and ruleRepetition, the document-level knobs remark-stringify takes. A marker the document uses two ways (- and * bullets, _ and * emphasis) is not recorded and reports via onWarning. Per-node style (mixed bullets on sibling lists, reference vs. inline links, setext for some headings) is out of scope by design (ADR 0004).

The record is inherited, not merely restored: a list added to the org file by hand is written out in the recorded style too.

Normalizations

One round trip lands on canonical form (ADR 0001), or on the recorded style where there is one; notable normalizations beyond formatting: