mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-20 04:34:08 +01:00
chore: Cleanup
This commit is contained in:
18
packages/mermaid-example-diagram/src/detector.ts
Normal file
18
packages/mermaid-example-diagram/src/detector.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// @ts-ignore: TODO Fix ts errors
|
||||
export const id = 'example-diagram';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
export const detector = (txt: string) => {
|
||||
return txt.match(/^\s*example-diagram/) !== null;
|
||||
};
|
||||
|
||||
export const loadDiagram = async () => {
|
||||
const { diagram } = await import('./diagram-definition');
|
||||
return { id, diagram };
|
||||
};
|
||||
Reference in New Issue
Block a user