fix: preserve internal tabs in list item content - #4086
Conversation
|
@nrps9909 is attempting to deploy a commit to the MarkedJS Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Move the tests to test/specs/new. You can use renderExact if you need to test white space.
There was a problem hiding this comment.
Moved the eight scenarios to test/specs/new/list_content_tabs.json, with separate GFM-on/off cases and renderExact: true on all 16 fixtures. They now compare the complete HTML string, including literal tabs and newlines, through the spec harness. The unit-test block is removed.
All 16 fixtures fail against the original base and pass on the updated branch. Full npm test passes with 1,818 spec-harness tests, 191 unit tests, docs/build, UMD/CJS, type/package checks and lint. The source fix is unchanged.
There was a problem hiding this comment.
Can you move this to .md and .html files? They are easier to view. You can add options as front matter
Marked version: 18.0.11, base
4417582f35d69926f0778ee133c3af75b7f3f966Markdown flavor: CommonMark / GitHub Flavored Markdown
Description
List parsing expands tabs throughout item text before that text reaches code-span or fenced-code tokenization. For example,
- \foo\tbar`renders two spaces betweenfooandbar, and a fence continuation containingfoo\tbar` renders four spaces. Both should retain the literal tab under CommonMark's tab rules.Expand only the leading spaces/tabs when preparing list lines. Content after that prefix reaches the child tokenizer unchanged. The first-line calculation retains its existing tab stops, continuation indentation retains its existing behavior, and pedantic mode retains its previous path.
This addresses internal content tabs in the list tokenizer discussed in #4050. It does not close that broad issue: tabs within the leading indentation, including a content tab directly after the list indent, still need original-column tracking across nested containers. It is separate from #4080's indented-code de-indentation change.
Validation:
renderExact: true; cases cover first-line/continuation code spans, backtick/tilde fences, ordered/nested lists, repeated internal tabs, and a structural indentation tab before the content.npm testpasses: 1,818 spec-harness tests, 191 unit tests, docs/build, UMD/CJS checks, type/package checks and lint.commonmark0.31.2 checks list-marker widths, whitespace prefixes and nested fences. This patch fixes 452 mismatches and introduces zero new mismatches; 1,410 existing mismatches in that deliberately broad corpus remain. The comparison preserves code whitespace while normalizing insignificant HTML formatting.Implemented and validated with Codex.
Contributor
Committer