Skip to content

Fix adjacent markdown syntax in blockquote #16596

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

Conversation

fiji-flo
Copy link
Contributor

@fiji-flo fiji-flo commented Aug 22, 2024

Description

Picking up work on #9099 with a slightly other approach than #9125. It's still hacky but the best way would require way more refactoring.

I'm checking whether the restored node value matches a newline followed by > (with optional spaces if it does just return the original node.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

Copy link

pkg-pr-new bot commented Jan 23, 2025

Open in Stackblitz

npm i https://pkg.pr.new/prettier@16596

commit: df6da2b

@fiji-flo
Copy link
Contributor Author

Thank you 🙏

@fisker
Copy link
Member

fisker commented Feb 18, 2025

Please add changelog for this.

@fiji-flo
Copy link
Contributor Author

Sure, thanks 🙏

@fiji-flo fiji-flo changed the title markdown: fix adjacent md syntax in blockqote markdown: fix adjacent md syntax in blockquote Feb 22, 2025
@fiji-flo
Copy link
Contributor Author

Thanks already for this. I wanted to that this issue will start happening more often since the [GFM note extension] is gaining popularity and easily triggers this.

> [!NOTE]
> [Prettier](https://prettier.io) will break this.

Which renders to:

Note

Prettier will break this.

Will be formatted to:

> [!NOTE] > [Prettier](https://prettier.io) will break this.

And render to:

[!NOTE] > Prettier will break this.

@fisker
Copy link
Member

fisker commented Mar 13, 2025

Thanks already for this. I wanted to that this issue will start happening more often since the [GFM note extension] is gaining popularity and easily triggers this.

That's a different issue #15479

You can fix in another PR, if you want.

@fiji-flo
Copy link
Contributor Author

I mean this PR fixes this already. I just forgot to mention this.

@fisker
Copy link
Member

fisker commented Mar 13, 2025

No, it's not. Nottice --prose-wrap always option.

Prettier pr-16596
Playground link

--parser markdown
--prose-wrap always

Input:

> [!NOTE]
> [Prettier](https://prettier.io) will break this.

Output:

> [!NOTE] [Prettier](https://prettier.io) will break this.

@fiji-flo
Copy link
Contributor Author

I see, that's right. I used preserve when I tested 🙈. I see if I can reshuffle things and try to fix this in another PR as you suggested. Thanks a lot for everything.

@fisker fisker changed the title markdown: fix adjacent md syntax in blockquote Fix adjacent markdown syntax in blockquote Mar 14, 2025
Copy link

netlify bot commented Mar 14, 2025

Deploy Preview for prettier ready!

Name Link
🔨 Latest commit df6da2b
🔍 Latest deploy log https://app.netlify.com/sites/prettier/deploys/67d4752f0c8e4e0008f301ed
😎 Deploy Preview https://deploy-preview-16596--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@fisker fisker merged commit 91c563e into prettier:main Mar 28, 2025
32 checks passed
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.

2 participants