Skip to main content
Version: 0.3.4

Markdown Elements — cedit md canonicalize Handling Reference

CategoryInput FormsCanonical OutputNotes
HeadingsATX (# H1–###### H6), Setext (H1 Alt===, H2 Alt---)ATX only (# H1, ## H2)Setext → ATX conversion
ParagraphsHard wraps, single lineReflowed (preserves hard breaks with trailing spaces)Line width ~80 chars
Unordered Lists-, *, + markers- onlyMarker normalized
Ordered Lists1., 1), #.1. onlyRenumbered sequentially
Nested Lists2/4 space indent2-space indentConsistent
Task Lists- [ ], - [x], - [X]- [ ], - [x]Checkbox preserved
Fenced CodeTriple backticks, tildes (~~~)```lang ```Triple backticks standard
Fenced w/ Nested BackticksAny containing ```Outer uses 4+ backticksAuto-promotes for nesting
Indented Code4-space indentFenced code block (```)Converted to fence
Blockquotes>, >> nesting> with blank line between paragraphsNesting preserved
TablesAny pipe alignment (`--,
Horizontal Rules---, ***, ___, ----________________________________________ (72 _)All → long underscore line
Links (Inline)[text](url "title")SamePreserved
Links (Reference)[text][ref] + [ref]: urlInlined to [text](url)References eliminated
Images![alt](url), reference styleInlined ![alt](url)References eliminated
Emphasis**, __, *, _, ~~**bold**, *italic*, ~~strike~~Normalized markers
Inline Code`code`, `code``code`Backtick count minimized
HTML BlocksRaw <div>...</div>Preserved verbatimPass-through
Front Matter (YAML)--- / +++ delimiters________________________________________ (hr) + content as heading-like⚠️ Loses structure — see below
Mermaid Diagrams```mermaid ... ```Same triple-backtick formUnchanged
Math ($$...$$)Display $$...$$SamePreserved byte-for-byte
Math ($...$)Inline $...$Same⚠️ Escapes \ inside — see cedit limits
Footnotes[^1], [^ref], definitions anywhereRef at use, defs at endDefinitions moved to bottom
Definition ListsTerm: Def (PHP Markdown Extra)Same formatPreserved (mdformat-gfm)
Escaped Chars\*, \_, \[, etc.SamePreserved

⚠️ Known Transformations / Caveats​

ElementBehaviorWorkaround
Front MatterConverted to horizontal rule + plain textUse mdformat-frontmatter plugin if you need preservation; or keep front matter in a separate tracked file
Reference Links/ImagesInlined (definitions dropped)Write as inline links; or accept inlining
$...$ with \Escaped to \\ inside GitHub mathUse → unicode, ```math fence, or code span `$\alpha$`
Unused Reference DefsSilently dropped (warning on stderr)Use all refs or convert to inline
Setext Headings→ ATXNo workaround needed; this is the canonical form
Indented Code→ FencedNo workaround needed

Quick Test Commands​

# Test one file
cedit md canonicalize path/to/file.md

# Test all MD files (dry-run check only)
find . -name '*.md' -exec cedit md canonicalize --check {} \;

# Canonicalize all in-place
find . -name '*.md' -print0 | xargs -0 -n1 cedit md canonicalize -i

Mermaid diagrams are completely safe — they remain as triple-backtick fenced blocks with mermaid info string, byte-for-byte identical to input.