Skip to content

Commit 5eda123

Browse files
sergicaljaffrepaul
andauthored
fix: Skip mermaid blocks in CodeBlock and rehype-onboarding-lines (#15496)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR * fix: Skip mermaid blocks in CodeBlock and rehype-onboarding-lines to prevent processing interference with client-side mermaid rendering (regression from #15473) ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: paulj <[email protected]>
1 parent b54a44f commit 5eda123

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/components/codeBlock/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ export function CodeBlock({filename, language, children}: CodeBlockProps) {
8585

8686
useCleanSnippetInClipboard(codeRef, {language});
8787

88+
// Mermaid blocks should not be processed by CodeBlock - they need special client-side rendering
89+
if (language === 'mermaid') {
90+
return <div className="language-mermaid">{children}</div>;
91+
}
92+
8893
async function copyCodeOnClick() {
8994
if (codeRef.current === null) {
9095
return;

src/rehype-onboarding-lines.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ function visitor(node) {
2929
if (!node.properties.className?.includes('code-highlight')) {
3030
return;
3131
}
32+
// ignore mermaid code blocks - they have special client-side rendering
33+
if (node.properties.className?.includes('language-mermaid')) {
34+
return;
35+
}
3236
handle_inline_options(node);
3337
}
3438

0 commit comments

Comments
 (0)