markedjs / markedjs/marked

Text after an empty nested blockquote is dropped (18.0.9+)

Open
#4,098 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

L2 - annoying
Dominant language
JavaScript
Stars
37.2k
Forks
3.7k
Avg merge
4d 3h
Merged PRs (30d)
19

Description

Marked version: 18.0.9 through 18.0.13 (18.0.8 is fine)

Describe the bug
Text on the line after an empty nested blockquote is dropped from the output, with default options.

To Reproduce

  1. Marked Demo
  2. CommonMark Demo

marked.parse('>>\ntext') in 18.0.8, matching the dingus:

<blockquote>
<blockquote>
</blockquote>
</blockquote>
<p>text</p>

In 18.0.9 to 18.0.13:

<blockquote>
<blockquote>
</blockquote>
</blockquote>

Same for >>>\ntext and > quote\n>>\ntext. With >>\ntext\n> more, the following > more blockquote disappears as well.

Expected behavior
The empty nested blockquote closes and text becomes a paragraph after it, as in CommonMark and 18.0.8.

This looks like it comes from #4030: the continuation branch in Tokenizer.blockquote() now appends every continuation line to raw, also when the re-tokenized nested blockquote did not consume them, so the lexer skips past text no token holds. Reverting that commit brings the paragraph back. I have a small fix with a spec test in test/specs/new/ and would be glad to open a PR if that is welcome.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Tokenizer.blockquote() and the change referenced in #4030, then reproduce the issue with the nested blockquote examples in the report. Add or inspect the spec test in test/specs/new/ and verify that text after an empty nested blockquote is preserved while the existing blockquote cases still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, markdown
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.