ordinary being 59635e0008
fix(lib): an indented closing fence closes the block (CommonMark/GitHub parity) (#1028)
fence_closes_p() required a closing fence's indent to be <= the opener's.
That is not a CommonMark rule and not how GitHub renders: a closing fence
may be indented up to three spaces regardless of the opener. A GitHub-valid
document was therefore read as still open, so lint reported a false
"does not nest" (and a false "never closed") and the OpenClaw split kept the
next "##" heading inside the previous section, leaving AGENTS.md empty.

The closing rule is now exactly the four conditions already enforced: same
character, run at least as long as the opener, indent 0-3, and nothing but
whitespace after the run. Callers still pass the opener's indent as the
optional fourth argument; it is documented as deliberately not consulted.

Regression fixtures in test-lint-fences.sh pin the helper boundaries (2- and
3-space closers close; a shorter or 4-space-indented run does not; tilde
closers follow the same rule), a lint run on the GitHub-valid document, and
the OpenClaw split. They fail on the previous code at the first new
assertion: "fence_closes_p rejected a bare closer indented 2 spaces under
an unindented opener".
2026-10-04 14:32:42 -05:00
..