mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
e688138167
there is no need for matching, capturing results, and validating nullablity just using `.test` would be enough and significantly faster for more info, see https://stackoverflow.com/10940138/16476610
21 lines
393 B
TypeScript
21 lines
393 B
TypeScript
import type { ExternalDiagramDefinition } from 'mermaid';
|
|
|
|
const id = 'example-diagram';
|
|
|
|
const detector = (txt: string) => {
|
|
return /^\s*example-diagram/.test(txt);
|
|
};
|
|
|
|
const loader = async () => {
|
|
const { diagram } = await import('./diagram-definition.js');
|
|
return { id, diagram };
|
|
};
|
|
|
|
const plugin: ExternalDiagramDefinition = {
|
|
id,
|
|
detector,
|
|
loader,
|
|
};
|
|
|
|
export default plugin;
|