mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53: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';
|
||||
}
|
||||
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);
|
||||
// Add the node
|
||||
|
@ -65,7 +65,9 @@ export const addVertices = function (vert, g, svgId, root, _doc) {
|
||||
label: vertexText
|
||||
.replace(/fa[lrsb]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
||||
.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();
|
||||
@ -245,7 +247,7 @@ export const addEdges = function (edges, g) {
|
||||
.replace(/fa[lrsb]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
||||
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||
katex
|
||||
.renderToString(c, { output: 'mathml', throwOnError: true, displayMode: true })
|
||||
.renderToString(c, { throwOnError: true, displayMode: true, output: 'html' })
|
||||
.replace(/\n/g, ' ')
|
||||
)}</span>`;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user