2023-02-08 17:42:58 +01:00
|
|
|
import type { ExternalDiagramDefinition } from 'mermaid';
|
2022-10-07 10:40:01 +02:00
|
|
|
|
2023-02-08 17:42:58 +01:00
|
|
|
const id = 'example-diagram';
|
2022-10-03 07:01:56 +02:00
|
|
|
|
2023-02-08 17:42:58 +01:00
|
|
|
const detector = (txt: string) => {
|
2022-09-28 17:49:47 +02:00
|
|
|
return txt.match(/^\s*example-diagram/) !== null;
|
|
|
|
};
|
2022-10-07 10:40:01 +02:00
|
|
|
|
2023-02-08 17:42:58 +01:00
|
|
|
const loader = async () => {
|
2023-02-16 12:56:32 +05:30
|
|
|
const { diagram } = await import('./diagram-definition.js');
|
2022-10-07 10:40:01 +02:00
|
|
|
return { id, diagram };
|
|
|
|
};
|
2023-02-08 17:42:58 +01:00
|
|
|
|
|
|
|
const plugin: ExternalDiagramDefinition = {
|
|
|
|
id,
|
|
|
|
detector,
|
|
|
|
loader,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default plugin;
|