Skip to content

fix: respect tab stops in list continuation indentation - #4119

Open
GreedyC wants to merge 1 commit into
markedjs:masterfrom
GreedyC:codex/fix-list-continuation-tab-stops
Open

GreedyC wants to merge 1 commit into
markedjs:masterfrom
GreedyC:codex/fix-list-continuation-tab-stops

Conversation

@GreedyC

@GreedyC GreedyC commented Sep 30, 2026 •

Copy link
Copy Markdown

Marked version: 18.0.14 (current master)

Markdown flavor: CommonMark and GitHub Flavored Markdown

Description

Related to the list/tab indentation discussion in #4050. This addresses the continuation-line tab-stop calculation only, not the separate preservation of leading tabs inside fenced code.

Expectation

In a list continuation line, a tab advances to the next four-column tab stop. For example, two spaces followed by a tab occupy four columns, not six:

marked.parse('- foo\n\n  \tbar');

After removing the two-column list indentation, bar remains a paragraph rather than an indented code block.

Result before this change

The leading whitespace replacement unconditionally added four spaces per tab. The example above therefore became an indented code block:

<ul>
<li><p>foo</p>
<pre><code>bar
</code></pre>
</li>
</ul>

Change

Reuse expandTabs for the leading whitespace of non-pedantic continuation lines, starting at column zero. Interior tabs and the pedantic branch remain untouched. The existing first-line path already uses this helper with the bullet-column offset.

Four new assertions failed on the unmodified implementation before the fix. The completed regression suite covers both parser flavors, unordered and one-/two-digit ordered markers, genuine indented code, interior tabs, tab-only blank lines, and nested lists. The reference CommonMark parser also confirms the paragraph-versus-code distinction for the reproducer.

Verification

  • npm test passed on macOS with Node 20.20.2, Node 22.23.3, and Node 24.16.0: 1,863 spec tests and 207 unit tests per run, plus UMD/CJS, type/export checks, lint, and documentation build.
  • Local GitHub Copilot CLI read-only review found no actionable defects. This is not an upstream reviewer approval.
  • Fork preflight passed all six full-suite jobs on Linux, Windows, and macOS with Node 20/24, checking out this PR's exact commit 05af44198272295a8e6255de053aeffc530684a1. npm scripts use Bash so Windows Node 20 expands the existing test/unit/*.test.js glob. A separate unchanged-baseline job confirms that the default Windows shell fails to expand that glob; no upstream package scripts were changed for this unrelated limitation.
  • Upstream Tests awaits maintainer workflow approval. Vercel reports "Authorization required to deploy" and its bot requests MarkedJS team authorization; it has not reported a build failure. Snyk passed. Fork results are not upstream approval.

AI assistance: Codex was used for implementation and verification, and GitHub Copilot CLI for an additional local review.

Contributor

  • Tests exist to ensure functionality and minimize regression.
  • If submitting a new feature, it has been documented in the appropriate places. (Not applicable: bug fix.)

Committer

  • CI is green (no forced merge required).
  • Squash and Merge PR following conventional commit guidelines.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 19:48
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

@GreedyC is attempting to deploy a commit to the MarkedJS Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests should be moved to test/specs/new

This branch has not been deployed

No deployments
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.

3 participants