Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: consecutive blockquotes blocks #560

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

frankie567
Copy link
Contributor

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.

Copy link

changeset-bot bot commented Mar 22, 2024

🦋 Changeset detected

Latest commit: 597d41b

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

Copy link
Owner

@quantizor quantizor left a comment

Choose a reason for hiding this comment

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

Thanks! Can you add a changeset? yarn changeset

@frankie567
Copy link
Contributor Author

Done ✨

@quantizor quantizor merged commit f5a0079 into quantizor:main Mar 22, 2024
2 checks passed
Innei pushed a commit to Innei/markdown-to-jsx that referenced this pull request Mar 28, 2024
* fix: consecutive blockquotes blocks

* chore: tweak changeset and add the example from OP

---------

Co-authored-by: Evan Jacobs <570070+quantizor@users.noreply.github.com>
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.

None yet

2 participants