mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-10 09:39:38 +02:00
Apply non-markdown label change for subgroups
This commit is contained in:

committed by
Anthony Juckel

parent
37269b47b5
commit
44a6434e59
@@ -993,4 +993,29 @@ flowchart TB
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('69: should render subgraphs with adhoc list headings', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
graph TB
|
||||||
|
subgraph "1. first"
|
||||||
|
a1-->a2
|
||||||
|
end
|
||||||
|
subgraph 2. second
|
||||||
|
b1-->b2
|
||||||
|
end
|
||||||
|
`,
|
||||||
|
{ fontFamily: 'courier' }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('70: should render subgraphs with markdown headings', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
graph TB
|
||||||
|
subgraph "\`**strong**\`"
|
||||||
|
a1-->a2
|
||||||
|
end
|
||||||
|
`,
|
||||||
|
{ fontFamily: 'courier' }
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1101,6 +1101,7 @@ You have to call mermaid.initialize.`
|
|||||||
id: subGraph.id,
|
id: subGraph.id,
|
||||||
label: subGraph.title,
|
label: subGraph.title,
|
||||||
labelStyle: '',
|
labelStyle: '',
|
||||||
|
labelType: subGraph.labelType,
|
||||||
parentId: parentDB.get(subGraph.id),
|
parentId: parentDB.get(subGraph.id),
|
||||||
padding: 8,
|
padding: 8,
|
||||||
cssCompiledStyles: this.getCompiledStyles(subGraph.classes),
|
cssCompiledStyles: this.getCompiledStyles(subGraph.classes),
|
||||||
|
@@ -30,11 +30,17 @@ const rect = async (parent, node) => {
|
|||||||
// Create the label and insert it after the rect
|
// Create the label and insert it after the rect
|
||||||
const labelEl = shapeSvg.insert('g').attr('class', 'cluster-label ');
|
const labelEl = shapeSvg.insert('g').attr('class', 'cluster-label ');
|
||||||
|
|
||||||
const text = await createText(labelEl, node.label, {
|
let text;
|
||||||
style: node.labelStyle,
|
if (node.labelType === 'markdown') {
|
||||||
useHtmlLabels,
|
text = await createText(labelEl, node.label, {
|
||||||
isNode: true,
|
style: node.labelStyle,
|
||||||
});
|
useHtmlLabels,
|
||||||
|
isNode: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const labelElement = await createLabel(node.label, node.labelStyle, false, true);
|
||||||
|
text = labelEl.node()?.appendChild(labelElement);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the size of the label
|
// Get the size of the label
|
||||||
let bbox = text.getBBox();
|
let bbox = text.getBBox();
|
||||||
|
Reference in New Issue
Block a user