2022-10-07 10:40:01 +02:00
|
|
|
// @ts-ignore: TODO Fix ts errors
|
|
|
|
export const id = 'example-diagram';
|
|
|
|
|
2022-10-03 07:01:56 +02:00
|
|
|
/**
|
|
|
|
* Detector function that will be called by mermaid to determine if the diagram is this type of digram.
|
|
|
|
*
|
|
|
|
* @param txt The diagram text will be passed to the detector
|
|
|
|
* @returns True if the diagram text matches a diagram of this type
|
|
|
|
*/
|
|
|
|
|
2022-09-28 17:49:47 +02:00
|
|
|
export const detector = (txt: string) => {
|
|
|
|
return txt.match(/^\s*example-diagram/) !== null;
|
|
|
|
};
|
2022-10-07 10:40:01 +02:00
|
|
|
|
|
|
|
export const loadDiagram = async () => {
|
|
|
|
const { diagram } = await import('./diagram-definition');
|
|
|
|
return { id, diagram };
|
|
|
|
};
|