mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-29 20:29:40 +02:00
fix for other styling fixes
This commit is contained in:
@@ -224,7 +224,9 @@ export const createText = async (
|
||||
const vertexNode = await addHtmlSpan(el, node, width, classes, addSvgBackground);
|
||||
return vertexNode;
|
||||
} else {
|
||||
const structuredText = markdownToLines(text.replace('<br>', '<br/>'), config);
|
||||
//sometimes the user might add br tags with 1 or more spaces in between, so we need to replace them with <br/>
|
||||
const sanitizeBR = text.replace(/<br\s*\/?>/g, '<br/>');
|
||||
const structuredText = markdownToLines(sanitizeBR.replace('<br>', '<br/>'), config);
|
||||
const svgLabel = createFormattedText(
|
||||
width,
|
||||
el,
|
||||
@@ -235,9 +237,13 @@ export const createText = async (
|
||||
if (/stroke:/.exec(style)) {
|
||||
style = style.replace('stroke:', 'lineColor:');
|
||||
}
|
||||
select(svgLabel)
|
||||
.select('text')
|
||||
.attr('style', style.replace(/color:/g, 'fill:'));
|
||||
|
||||
const nodeLabelTextStyle = style
|
||||
.replace(/stroke:[^;]+;?/g, '')
|
||||
.replace(/stroke-width:[^;]+;?/g, '')
|
||||
.replace(/fill:[^;]+;?/g, '')
|
||||
.replace(/color:/g, 'fill:');
|
||||
select(svgLabel).attr('style', nodeLabelTextStyle);
|
||||
// svgLabel.setAttribute('style', style);
|
||||
} else {
|
||||
//On style, assume `stroke`, `stroke-width` are used for edge path, so remove them
|
||||
|
@@ -81,6 +81,8 @@ export function markdownToHTML(markdown: string, { markdownAutoWrap }: MermaidCo
|
||||
return `<em>${node.tokens?.map(output).join('')}</em>`;
|
||||
} else if (node.type === 'paragraph') {
|
||||
return `<p>${node.tokens?.map(output).join('')}</p>`;
|
||||
} else if (node.type === 'space') {
|
||||
return '';
|
||||
} else if (node.type === 'html') {
|
||||
return `${node.text}`;
|
||||
}
|
||||
|
Reference in New Issue
Block a user