Skip to content

Commit

Permalink
[#65872] use parent in mermaid plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Trzcin committed Sep 20, 2024
1 parent 0553955 commit 5258dce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/hooks/markdownMermaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const hashSeed = 42;
// key = hash of diagram source code
const contentCache = new Map();

const markdownItMermaid = (md, { preview, lineMap, parent }) => {
const markdownItMermaid = (md, { lineMap, parent }) => {
mermaid.initialize({
theme: "neutral",
suppressErrorRendering: true,
Expand Down Expand Up @@ -49,7 +49,7 @@ const markdownItMermaid = (md, { preview, lineMap, parent }) => {
container.style.visibility = "none";
document.body.appendChild(container);

waitForElement(preview.current, `mermaid-${id}`).then((el) => {
waitForElement(parent, `mermaid-${id}`).then((el) => {
mermaid
.render(`mermaid-${id}`, code, container)
.then(({ svg }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useText.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const useText = ({ initialText, transforms, customRoles, preview, backsla
.use(markdownitDocutils)
.use(markdownReplacer(transforms, parent))
.use(useCustomRoles(customRoles, parent))
.use(markdownMermaid, { preview, lineMap, parent })
.use(markdownMermaid, { lineMap, parent })
.use(markdownSourceMap, addFoldUI);
if (backslashLineBreak) md.use(backslashLineBreakPlugin);
return md;
Expand Down

0 comments on commit 5258dce

Please sign in to comment.