Yokozuna59 e688138167 pref: change detectors from .match into .test
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
2023-06-12 14:45:08 +03:00

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;