Skip to content

fix: preserve <br> line breaks in fenced code - #1

Merged
matlec merged 1 commit into
mainfrom
fix/linebreak-rendering
Jul 24, 2026
Merged

fix: preserve <br> line breaks in fenced code#1
matlec merged 1 commit into
mainfrom
fix/linebreak-rendering

Conversation

@matlec

@matlec matlec commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@phil-abb's review comment on my PR revealed an issue with how we handle <br> when assembling content for the site.

Summary

The content sync deletes every <br> from Markdown before the MDX build (sed 's/<br>//g'). Inside mermaid diagrams a <br> is a real line break, so a label like GET /api/v1/deployments followed by Header: If-None-Match: "sha256:abc..." renders as one run of text on the site.

Change

Replace the blanket delete with a pass that depends on context. Inside fenced code, self-close <br> so mermaid keeps its breaks. Everywhere else, strip it as before: a bare <br> is invalid JSX, and in a heading it becomes a raw node that crashes fumadocs' rehypeToc. This also drops the macOS/Linux sed -i split, since awk is portable.

Verification

I ran the sync and dev server against a branch that uses <br> in a mermaid diagram. The diagram renders with line breaks.

Signed-off-by: Matthias Lechner <matlec.public@gmail.com>
@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for margo-docs ready!

Name Link
🔨 Latest commit 1b2e6b1
🔍 Latest deploy log https://app.netlify.com/projects/margo-docs/deploys/6a623e8a65b301000755d320
😎 Deploy Preview https://deploy-preview-1--margo-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@matlec
matlec merged commit fec88bc into main Jul 24, 2026
6 checks passed
@matlec
matlec deleted the fix/linebreak-rendering branch July 24, 2026 06:20
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