Skip to content

Commit 02b56c2

Browse files
authored
Fix mermaid rendering in repo transforms (#115)
Signed-off-by: Pete Cheslock <[email protected]>
1 parent ed63fea commit 02b56c2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

remote-content/remote-sources/repo-transforms.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,13 @@ function applyBasicMdxFixes(content) {
7979

8080
return `:::${docusaurusType}\n${cleanContent}\n:::\n`;
8181
})
82-
// Fix HTML comments for MDX compatibility
83-
.replace(/<!--\s*/g, '{/* ')
84-
.replace(/\s*-->/g, ' */}')
82+
// Fix HTML comments for MDX compatibility (without breaking Mermaid arrows)
83+
.replace(/<!--([\s\S]*?)-->/g, (_match, comment) => {
84+
const normalized = comment
85+
.replace(/^\s*/, ' ')
86+
.replace(/\s*$/, ' ');
87+
return `{/*${normalized}*/}`;
88+
})
8589
// Fix HTML tags for MDX compatibility
8690
.replace(/<br>/g, '<br />')
8791
.replace(/<br([^/>]*?)>/g, '<br$1 />')

0 commit comments

Comments
 (0)