Skip to content

fix(breaks): preserve newlines in whitespace-sensitive elements - #312

Merged
farnabaz merged 4 commits into
comarkdown:mainfrom
Snack-X:fix/breaks-whitespace-sensitive-tags
Jul 30, 2026
Merged

fix(breaks): preserve newlines in whitespace-sensitive elements#312
farnabaz merged 4 commits into
comarkdown:mainfrom
Snack-X:fix/breaks-whitespace-sensitive-tags

Conversation

@Snack-X

@Snack-X Snack-X commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves: #311

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

In breaks plugin, ignored list of tags is added while walking through the child nodes.

In addition to <pre> and <code> which are related to the linked issue, <math>, <script>, <style>, and <textarea> are also in the ignorelist.

📝 Checklist

  • I have linked an issue or discussion.
  • I have run pnpm verify and it passes.
  • I have updated the documentation accordingly.

@Snack-X
Snack-X requested a review from farnabaz as a code owner July 30, 2026 09:34
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Snack-X is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

npm i https://pkg.pr.new/comark@312

@comark/angular

npm i https://pkg.pr.new/@comark/angular@312

@comark/ansi

npm i https://pkg.pr.new/@comark/ansi@312

@comark/html

npm i https://pkg.pr.new/@comark/html@312

@comark/nuxt

npm i https://pkg.pr.new/@comark/nuxt@312

@comark/react

npm i https://pkg.pr.new/@comark/react@312

@comark/svelte

npm i https://pkg.pr.new/@comark/svelte@312

@comark/vue

npm i https://pkg.pr.new/@comark/vue@312

commit: 67557b9

@farnabaz farnabaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks

@farnabaz

Copy link
Copy Markdown
Collaborator

@Snack-X Thanks for the PR.
Do you mind enabling Commit Sign and update all commits in this PR? Due to Org rules all commits should be signed.

The breaks plugin converted every newline in string children to a
`br` node, including inside code and math blocks where newlines must
stay literal. Skip visiting whitespace-sensitive tags (`pre`, `code`,
`math`, `script`, `style`, `textarea`) so their content is untouched.

Fixes comarkdown#311

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Snack-X
Snack-X force-pushed the fix/breaks-whitespace-sensitive-tags branch from 494df50 to 7d86564 Compare July 30, 2026 13:06
@Snack-X

Snack-X commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@farnabaz I think it is signed now, judging by the "Verified" badge on the commit

@farnabaz
farnabaz merged commit 693e855 into comarkdown:main Jul 30, 2026
4 of 12 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.

Misbehavior in breaks plugin

2 participants