mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-11 18:19:42 +02:00
Default to markdown for nodes from metadata
This commit is contained in:
@@ -85,6 +85,17 @@ export class FlowDB implements DiagramDB {
|
|||||||
return common.sanitizeText(txt, this.config);
|
return common.sanitizeText(txt, this.config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sanitizeNodeLabelType(labelType: string) {
|
||||||
|
switch (labelType) {
|
||||||
|
case 'markdown':
|
||||||
|
case 'string':
|
||||||
|
case 'text':
|
||||||
|
return labelType;
|
||||||
|
default:
|
||||||
|
return 'markdown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to lookup domId from id in the graph definition.
|
* Function to lookup domId from id in the graph definition.
|
||||||
*
|
*
|
||||||
@@ -208,6 +219,7 @@ export class FlowDB implements DiagramDB {
|
|||||||
|
|
||||||
if (doc?.label) {
|
if (doc?.label) {
|
||||||
vertex.text = doc?.label;
|
vertex.text = doc?.label;
|
||||||
|
vertex.labelType = this.sanitizeNodeLabelType(doc?.labelType ?? 'markdown');
|
||||||
}
|
}
|
||||||
if (doc?.icon) {
|
if (doc?.icon) {
|
||||||
vertex.icon = doc?.icon;
|
vertex.icon = doc?.icon;
|
||||||
|
@@ -29,7 +29,7 @@ export interface FlowVertex {
|
|||||||
domId: string;
|
domId: string;
|
||||||
haveCallback?: boolean;
|
haveCallback?: boolean;
|
||||||
id: string;
|
id: string;
|
||||||
labelType: 'text';
|
labelType: 'markdown' | 'string' | 'text';
|
||||||
link?: string;
|
link?: string;
|
||||||
linkTarget?: string;
|
linkTarget?: string;
|
||||||
props?: any;
|
props?: any;
|
||||||
@@ -62,7 +62,7 @@ export interface FlowEdge {
|
|||||||
style?: string[];
|
style?: string[];
|
||||||
length?: number;
|
length?: number;
|
||||||
text: string;
|
text: string;
|
||||||
labelType: 'text';
|
labelType: 'markdown' | 'string' | 'text';
|
||||||
classes: string[];
|
classes: string[];
|
||||||
id?: string;
|
id?: string;
|
||||||
animation?: 'fast' | 'slow';
|
animation?: 'fast' | 'slow';
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
export interface NodeMetaData {
|
export interface NodeMetaData {
|
||||||
shape?: string;
|
shape?: string;
|
||||||
label?: string;
|
label?: string;
|
||||||
|
labelType?: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
form?: string;
|
form?: string;
|
||||||
pos?: 't' | 'b';
|
pos?: 't' | 'b';
|
||||||
|
Reference in New Issue
Block a user