Skip to content

v0.2.0

Choose a tag to compare

@Vusys Vusys released this 09 Aug 17:56
· 5 commits to master since this release

Five reflow correctness fixes. Each one caused wrap/unwrap to emit a document that parsed differently from its input — not a formatting nit but silent corruption, in most cases with no visible sign that anything had gone wrong.

If you have run wrap or unwrap over documents with 0.1.0, it is worth re-checking anything containing a multi-block blockquote or a nested list.

Fixed

  • Blank lines inside a blockquote keep their > marker. Previously emitted bare, which ends a quote — so one quote containing several paragraphs (or a code block, list, or nested quote) came back out as several separate quotes. Across a 232-file corpus this was the single largest cause of corruption. (#5)
  • Wrapping no longer turns prose into block markup. A line break that pushed a -, +, #, 1., 1), or a ---/=== run to the start of a line reinterpreted the text as a list, heading, or setext underline. Because it depended on where the break landed, the same document could round-trip cleanly at --width=80 and corrupt at 79. Also fixes markers the author escaped in the source, which were unescaped on output at every width. (#6)
  • A tight list containing a nested sublist stays tight. A blank line before the sublist promoted the whole list to loose, wrapping every item's content in a <p> — including siblings that had no sublist at all. (#7)
  • An empty list item keeps its marker instead of being dropped. The item disappeared, leaving a stray blank line, and an ordered list renumbered around the gap so surviving items silently changed number. (#8)
  • A literal U+0001 is no longer turned into a hard line break. That byte is the in-band sentinel used to mark a real hard break, so an occurrence in the document was indistinguishable from one. It is now stripped before parsing — note this means the byte is dropped rather than preserved. (#9)

Added

  • DocumentParser::environment() exposes the shared CommonMark environment, so callers needing a renderer rather than a parser get the identical extension set instead of a copy that can drift.
  • A fixture catalogue for reflow round-trips (tests/Fixtures/Reflow). Every case must match its expected output, be unchanged by a second pass, and render to the same HTML as its input. That last property is what all five bugs above broke, and it is now enforced across 45 cases.

Full changelog: v0.1.0...v0.2.0