Skip to content

fix: keep tabs in fenced code inside a block quote - #4185

Open
dyk1454683243-sudo wants to merge 1 commit into
markedjs:masterfrom
dyk1454683243-sudo:fix/4184-blockquote-fence-tab
Open

dyk1454683243-sudo wants to merge 1 commit into
markedjs:masterfrom
dyk1454683243-sudo:fix/4184-blockquote-fence-tab

Conversation

@dyk1454683243-sudo

Copy link
Copy Markdown
Contributor

Marked version: 18.1.2 and later (current master)

Markdown flavor: CommonMark | GitHub Flavored Markdown

Description

#4110 expanded the whole whitespace run after a block quote's > into spaces. When a fenced code block sits inside the block quote, a tab in the code is part of that run, so it came out as spaces.

stripBlockquoteLines now takes only the > marker and its one optional space column. When that column is a tab, the rest of its tab stop is kept as spaces, so CommonMark example 6 (>\t\tfoo) still renders as indented code. Leading tabs outside a fence are still expanded. On lines inside an open fence, tabs stay as they are. The opening and closing fence lines are still expanded, so the space-only fence rules keep matching. Pedantic mode is unchanged.

Contributor

  • Test(s) exist to ensure functionality and minimize regression: a new spec test/specs/new/blockquote_fenced_code_tab.md (with renderExact: true) and unit tests in test/unit/marked.test.js that compare exact strings, including the tab byte. npm test passes: 1985 spec tests, 245 unit tests, plus UMD, CJS, types and lint.
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

The block quote marker consumes one optional space column. Expanding the
whole whitespace run after `>` turned a content tab inside a fence into
spaces. Leading tabs outside a fence are still expanded so indented code
keeps CommonMark example 6.

Fixes markedjs#4184

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@vercel

vercel Bot commented Nov 2, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

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.

Tab inside a fenced code block in a block quote is expanded to spaces (regression in 18.1.2)

2 participants