barkdown
This is a Lightning Jar package. See the full package page →
barkdown is a Markdown to DOM round-trip codec, guaranteed to invert marked. Parse markdown to HTML, edit it as a live DOM (contenteditable, WYSIWYG, or programmatic transforms), and serialize back to markdown that is provably the same document. The contract is a testable mathematical property: one round trip canonicalizes any input, a second is byte-identical, footnotes survive exactly, and unknown elements pass through as raw HTML with no silent loss.
It is the sibling of barkup: barkup guards the tree's identity, barkdown guards the prose's. We extracted it from our production blog CMS, where every keystroke of the WYSIWYG editor round-trips through it, and the guarantees are enforced by a corpus suite plus property tests running about 2,000 random documents per run. Published on npm as @kevinpeckham/barkdown under the MIT license.
How We Use It
- Serializing WYSIWYG and contenteditable output back to clean markdown
- Round-tripping markdown through programmatic DOM transforms without drift
- Keeping footnotes, tables, and raw HTML intact across repeated edit cycles
Content Formats & Parsing
Why this matters: Content lives longest in plain-text formats people can read and machines can parse without guessing, so it survives tools, platforms and migrations. We use and build notations, parsers and converters that keep content in readable text, parse it with documented rules, and round-trip it to rendered output and other formats without silent changes. Preferred defaults: marked for spec-tested markdown rendering; barkdown for markdown edited as a live DOM; barmark for chord charts.