Repository navigation
fix(MD070): skip a fence that ends with its list item - #967
Merged
rvben merged 1 commit intoOct 20, 2026
Merged
Conversation
CommonMark ends a fenced code block that has no closing fence with the list item that holds it. MD070 searched the rest of the document for a closing fence instead, so a later, separate fenced block counted as a collision, and the fix wrapped the text between them into one code block. The check now skips a fence the parser marks as not closed (CodeBlockDetail.closed). MD070 then reads the document the way the format proof does, so `rumdl fmt -` and `rumdl fmt <file>` give the same result. Before, the proof skipped MD070 on stdin, while the file path applied the wrong fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
CommonMark ends a fenced code block that has no closing fence with the
list item that holds it. MD070 kept searching the rest of the document
for a closing fence, so with
it reported the
textfence as a collision inside theyamlblock. Itsfix turned the
yamlfence into four backticks and closed it after thetextblock, so "After the list." and the second block rendered as code.markdown-it's commonmark preset reads the same document as two separate
blocks with a paragraph between them.
Since 0.3.0 the same document also gives different results on stdin and
on a file.
rumdl fmt -leaves it unchanged and prints "0 issues fixed,1 issue remaining", while
rumdl fmt file.mdapplies the fix; 0.2.79applied it in both. The formatter skips rules the format proof covers.
The proof reads the parser's blocks and finds no collision, so stdin
skips MD070, while the file path runs MD070's own scan.
The check now skips a fence the parser marks as not closed
(
CodeBlockDetail.closed, which MD031 uses since 0.3.0), so MD070 andthe proof read the document the same way. Fences the parser closes are
checked as before, and a nested collision inside a list item is still
reported (
test_indented_code_block_in_list).Type of Change
Testing
test_unclosed_fence_ends_with_its_list_itemfor MD070and
fence_ended_by_its_list_item_is_proven_for_md070for the formatproof (through
assert_proofs). Both fail without the change; the prooftest reports "MD070 incorrectly proved unchanged".
cargo test --no-fail-fastwith Rust 1.96.1 (thetest-legacytarget, since nextest was not available in my build container). All
tests pass except timing tests in
perf::rule_complexity_regression_testand
test_performance_many_consecutive_items. Those failed the same wayon unchanged
mainin the same container, a debug build on a busy host,and the failing set changes from run to run.
rumdl check,rumdl fmt -andrumdl fmt file.md, before and after the change.Checklist
cargo fmt --check, andcargo clippy --workspace --lib --bins --tests -- -D warnings -D clippy::uninlined_format_args)