mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-10 10:59:51 +02:00
fix: handling annotations
This commit is contained in:
@@ -44,7 +44,7 @@ function addHtmlLabel(node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createLabel = (_vertexText, style, isTitle, isNode) => {
|
const createLabel = (_vertexText, style, isTitle, isNode) => {
|
||||||
let vertexText = sanitizeTxt(_vertexText || '');
|
let vertexText = _vertexText || '';
|
||||||
if (typeof vertexText === 'object') vertexText = vertexText[0];
|
if (typeof vertexText === 'object') vertexText = vertexText[0];
|
||||||
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?
|
||||||
|
@@ -139,16 +139,15 @@ export const addMember = function (className, member) {
|
|||||||
|
|
||||||
if (typeof member === 'string') {
|
if (typeof member === 'string') {
|
||||||
// Member can contain white spaces, we trim them out
|
// Member can contain white spaces, we trim them out
|
||||||
// const memberString = sanitizeText(member.trim());
|
|
||||||
const memberString = member.trim();
|
const memberString = member.trim();
|
||||||
|
|
||||||
if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
|
if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
|
||||||
// Remove leading and trailing brackets
|
// Remove leading and trailing brackets
|
||||||
theClass.annotations.push(memberString.substring(2, memberString.length - 2));
|
theClass.annotations.push(sanitizeText(memberString.substring(2, memberString.length - 2)));
|
||||||
} else if (memberString.indexOf(')') > 0) {
|
} else if (memberString.indexOf(')') > 0) {
|
||||||
theClass.methods.push(memberString);
|
theClass.methods.push(sanitizeText(memberString));
|
||||||
} else if (memberString) {
|
} else if (memberString) {
|
||||||
theClass.members.push(memberString);
|
theClass.members.push(sanitizeText(memberString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user