mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
fix(katex): enforce html output for consistency
This commit is contained in:
parent
275f2002b5
commit
4736e59393
@ -142,7 +142,9 @@ export const addVertices = function (vert, g, svgId, root, doc) {
|
|||||||
_shape = 'rect';
|
_shape = 'rect';
|
||||||
}
|
}
|
||||||
const labelText = vertexText.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
const labelText = vertexText.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||||
katex.renderToString(c, { throwOnError: true, displayMode: true }).replace(/\n/g, ' ')
|
katex
|
||||||
|
.renderToString(c, { throwOnError: true, displayMode: true, output: 'html' })
|
||||||
|
.replace(/\n/g, ' ')
|
||||||
);
|
);
|
||||||
console.log(labelText);
|
console.log(labelText);
|
||||||
// Add the node
|
// Add the node
|
||||||
|
@ -65,7 +65,9 @@ export const addVertices = function (vert, g, svgId, root, _doc) {
|
|||||||
label: vertexText
|
label: vertexText
|
||||||
.replace(/fa[lrsb]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
.replace(/fa[lrsb]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
||||||
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||||
katex.renderToString(c, { throwOnError: true, displayMode: true }).replace(/\n/g, ' ')
|
katex
|
||||||
|
.renderToString(c, { throwOnError: true, displayMode: true, output: 'html' })
|
||||||
|
.replace(/\n/g, ' ')
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
vertexNode = addHtmlLabel(svg, node).node();
|
vertexNode = addHtmlLabel(svg, node).node();
|
||||||
@ -245,7 +247,7 @@ export const addEdges = function (edges, g) {
|
|||||||
.replace(/fa[lrsb]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
.replace(/fa[lrsb]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
||||||
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||||
katex
|
katex
|
||||||
.renderToString(c, { output: 'mathml', throwOnError: true, displayMode: true })
|
.renderToString(c, { throwOnError: true, displayMode: true, output: 'html' })
|
||||||
.replace(/\n/g, ' ')
|
.replace(/\n/g, ' ')
|
||||||
)}</span>`;
|
)}</span>`;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user