Skip to content

Keep nested bullet-list markers aligned in CommonMark output - #665

Closed
i1rr wants to merge 2 commits into
commonmark:masterfrom
i1rr:super-hero/cmark-nested-list-markers
Closed

i1rr wants to merge 2 commits into
commonmark:masterfrom
i1rr:super-hero/cmark-nested-list-markers

Conversation

@i1rr

@i1rr i1rr commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

cmark_render_commonmark() adds two leading spaces to a first-child nested bullet list even when it continues the enclosing marker on the same line. This makes the parsed parent indentation disagree with the continuation prefix, so the valid-Markdown adjacent-list input in #662 moves content outside its parent on roundtrip. Use a two-character bullet marker consistently across that nested list, guard the optional parent explicitly, and add API regressions for the reported case and later siblings.

Verification on Linux, GCC 13.3, CMake and Python 3.12.3:

  • Shared Debug: all nine CTest entries succeed; API 567 assertions pass. The new API tests on original source produce one failure, and reject a first-item-only draft with two later-sibling failures.
  • Static Debug: all five CTest entries and 567 API assertions pass.
  • All 652 official roundtrip comparisons pass by counting the comparator's return values; the existing Python driver currently ignores those returns. A semantic comparison of 580 input/width pairs gives 386 improvements/194 retained passes, no regressions, plus eight byte-identical unaffected outputs.
  • Complete-file patch apply/reverse/reapply passes with zero fuzz.

Commands: cmake -S . -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug -DSPEC_TESTS=ON, cmake --build build, ctest --test-dir build --output-on-failure. Repeat with BUILD_SHARED_LIBS=OFF for static.

The initial hosted clang-tidy run required an explicit parent guard; the guard-only revision passes the same native checks and 580 unchanged semantic comparisons from that exact remote head. Local clang-tidy, sanitizers, other platforms and real use were not tested; hosted lint must be checked on the new head. Prepared with OpenAI Codex assistance.

jgm added a commit that referenced this pull request Nov 25, 2026
This created problems with indented bullet lists, because
subitems didn't line up with the content of teh main item.

Obsoletes #665.
@jgm

jgm commented Nov 25, 2026

Copy link
Copy Markdown
Member

Fixed in a different way by commit f4eec01

@jgm jgm closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants