quantizor / markdown-to-jsx

🏭 The most lightweight, customizable React markdown component.
https://markdown-to-jsx.quantizor.dev/
MIT License
1.96k stars 169 forks source link

fix: consecutive blockquotes blocks #560

Closed frankie567 closed 5 months ago

frankie567 commented 5 months ago

Currently, if we have consecutive blockquotes, they are rendered as one:

Input

> Block A.1
> Block A.2

> Block B.1

Output

<blockquote>
  <p>Block A.1</p>
  <p>Block A.2</p>
  <p>Block.B.1</p>
</blockquote>

This is not compliant with the GFM spec which states that we should create consecutive blocks if there is a blank line between them


This PR solves that by tweaking the BLOCKQUOTE_R regex and adding relevant tests. Basically, we use a lookahead to match everything until we hit at least two \n.

changeset-bot[bot] commented 5 months ago

🦋 Changeset detected

Latest commit: 597d41be0aaf27fa52dcf316e5074731df2cf3fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | --------------- | ----- | | markdown-to-jsx | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

frankie567 commented 5 months ago

Done ✨