mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-15 10:14:21 +01:00
fix: fallback to raw text instead of rendering empty boxes when htmlLabels: false
This commit is contained in:
@@ -1165,9 +1165,8 @@ end
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render raw strings for unsuported markdown', () => {
|
describe('when rendering unsuported markdown', () => {
|
||||||
imgSnapshotTest(
|
const graph = `flowchart TB
|
||||||
`flowchart TB
|
|
||||||
mermaid{"What is\nyourmermaid version?"} --> v10["<11"] --"\`<**1**1\`"--> fine["No bug"]
|
mermaid{"What is\nyourmermaid version?"} --> v10["<11"] --"\`<**1**1\`"--> fine["No bug"]
|
||||||
mermaid --> v11[">= v11"] -- ">= v11" --> broken["Affected by https://github.com/mermaid-js/mermaid/issues/5824"]
|
mermaid --> v11[">= v11"] -- ">= v11" --> broken["Affected by https://github.com/mermaid-js/mermaid/issues/5824"]
|
||||||
subgraph subgraph1["\`How to fix **fix**\`"]
|
subgraph subgraph1["\`How to fix **fix**\`"]
|
||||||
@@ -1177,7 +1176,14 @@ end
|
|||||||
githost2["\`Github, Gitlab, BitBucket, etc.\`"]
|
githost2["\`Github, Gitlab, BitBucket, etc.\`"]
|
||||||
a["1."]
|
a["1."]
|
||||||
b["- x"]
|
b["- x"]
|
||||||
`
|
`;
|
||||||
);
|
|
||||||
|
it('should render raw strings', () => {
|
||||||
|
imgSnapshotTest(graph);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render raw strings with htmlLabels: false', () => {
|
||||||
|
imgSnapshotTest(graph, { htmlLabels: false });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ export function markdownToLines(markdown: string, config: MermaidConfig = {}): M
|
|||||||
});
|
});
|
||||||
} else if (treeNode.type === 'html') {
|
} else if (treeNode.type === 'html') {
|
||||||
lines[currentLine].push({ content: treeNode.text, type: 'normal' });
|
lines[currentLine].push({ content: treeNode.text, type: 'normal' });
|
||||||
|
} else {
|
||||||
|
lines[currentLine].push({ content: treeNode.raw, type: 'normal' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user