mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
chore(katex): lint:fix
This commit is contained in:
parent
fb5d80a7a1
commit
bbc6eb6ee7
@ -22,7 +22,12 @@ export const setConf = function (cnf: any) {
|
|||||||
* @param mermaidVersion - The version
|
* @param mermaidVersion - The version
|
||||||
* @param error - The caught error
|
* @param error - The caught error
|
||||||
*/
|
*/
|
||||||
export const draw = (_text: string, id: string, mermaidVersion: string, error: Error | null = null) => {
|
export const draw = (
|
||||||
|
_text: string,
|
||||||
|
id: string,
|
||||||
|
mermaidVersion: string,
|
||||||
|
error: Error | null = null
|
||||||
|
) => {
|
||||||
try {
|
try {
|
||||||
log.debug('Renering svg for syntax error\n');
|
log.debug('Renering svg for syntax error\n');
|
||||||
|
|
||||||
|
@ -59,11 +59,13 @@ export const addVertices = function (vert, g, svgId, root, doc, diagObj) {
|
|||||||
if (evaluate(getConfig().flowchart.htmlLabels)) {
|
if (evaluate(getConfig().flowchart.htmlLabels)) {
|
||||||
// TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
// TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
||||||
const node = {
|
const node = {
|
||||||
label: vertexText.replace(
|
label: vertexText
|
||||||
/fa[blrs]?:fa-[\w-]+/g,
|
.replace(/fa[blrs]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
||||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||||
).replace(/\$\$(.*)\$\$/g, (r, c) =>
|
katex
|
||||||
katex.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' }).replace(/\n/g, ' ').replace(/<annotation.*<\/annotation>/g, '')
|
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
|
||||||
|
.replace(/\n/g, ' ')
|
||||||
|
.replace(/<annotation.*<\/annotation>/g, '')
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
vertexNode = addHtmlLabel(svg, node).node();
|
vertexNode = addHtmlLabel(svg, node).node();
|
||||||
@ -147,7 +149,8 @@ export const addVertices = function (vert, g, svgId, root, doc, diagObj) {
|
|||||||
const labelText = vertexText.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
const labelText = vertexText.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||||
katex
|
katex
|
||||||
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
|
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
|
||||||
.replace(/\n/g, ' ').replace(/<annotation.*<\/annotation>/g, '')
|
.replace(/\n/g, ' ')
|
||||||
|
.replace(/<annotation.*<\/annotation>/g, '')
|
||||||
);
|
);
|
||||||
// Add the node
|
// Add the node
|
||||||
g.setNode(vertex.id, {
|
g.setNode(vertex.id, {
|
||||||
@ -319,7 +322,10 @@ export const addEdges = function (edges, g, diagObj) {
|
|||||||
edgeData.label = edge.text
|
edgeData.label = edge.text
|
||||||
.replace(common.lineBreakRegex, '\n')
|
.replace(common.lineBreakRegex, '\n')
|
||||||
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||||
katex.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' }).replace(/\n/g, ' ').replace(/<annotation.*<\/annotation>/g, '')
|
katex
|
||||||
|
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
|
||||||
|
.replace(/\n/g, ' ')
|
||||||
|
.replace(/<annotation.*<\/annotation>/g, '')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (edge.style === undefined) {
|
if (edge.style === undefined) {
|
||||||
|
@ -58,13 +58,13 @@ export const addVertices = function (vert, g, svgId, root, _doc, diagObj) {
|
|||||||
if (evaluate(getConfig().flowchart.htmlLabels)) {
|
if (evaluate(getConfig().flowchart.htmlLabels)) {
|
||||||
// TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
// TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
||||||
const node = {
|
const node = {
|
||||||
label: vertexText.replace(
|
label: vertexText
|
||||||
/fa[blrs]?:fa-[\w-]+/g,
|
.replace(/fa[blrs]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
||||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||||
).replace(/\$\$(.*)\$\$/g, (r, c) =>
|
|
||||||
katex
|
katex
|
||||||
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
|
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
|
||||||
.replace(/\n/g, ' ').replace(/<annotation.*<\/annotation>/g, '')
|
.replace(/\n/g, ' ')
|
||||||
|
.replace(/<annotation.*<\/annotation>/g, '')
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
vertexNode = addHtmlLabel(svg, node).node();
|
vertexNode = addHtmlLabel(svg, node).node();
|
||||||
@ -244,13 +244,13 @@ export const addEdges = function (edges, g, diagObj) {
|
|||||||
edgeData.labelType = 'html';
|
edgeData.labelType = 'html';
|
||||||
edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}" style="${
|
edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}" style="${
|
||||||
edgeData.labelStyle
|
edgeData.labelStyle
|
||||||
}">${edge.text.replace(
|
}">${edge.text
|
||||||
/fa[blrs]?:fa-[\w-]+/g,
|
.replace(/fa[blrs]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
|
||||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
.replace(/\$\$(.*)\$\$/g, (r, c) =>
|
||||||
).replace(/\$\$(.*)\$\$/g, (r, c) =>
|
|
||||||
katex
|
katex
|
||||||
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
|
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
|
||||||
.replace(/\n/g, ' ').replace(/<annotation.*<\/annotation>/g, '')
|
.replace(/\n/g, ' ')
|
||||||
|
.replace(/<annotation.*<\/annotation>/g, '')
|
||||||
)}</span>`;
|
)}</span>`;
|
||||||
} else {
|
} else {
|
||||||
edgeData.labelType = 'text';
|
edgeData.labelType = 'text';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user