Mind map coming in from the cold. A lazy loaded diagram in the same way as timeline.

This commit is contained in:
Knut Sveidqvist
2023-02-08 17:42:58 +01:00
parent 38a84a7fe0
commit 74df4a7a68
34 changed files with 206 additions and 344 deletions

View File

@@ -1,18 +1,20 @@
// @ts-ignore: TODO Fix ts errors
export const id = 'example-diagram';
import type { ExternalDiagramDefinition } from 'mermaid';
/**
* Detector function that will be called by mermaid to determine if the diagram is this type of diagram.
*
* @param txt - The diagram text will be passed to the detector
* @returns True if the diagram text matches a diagram of this type
*/
const id = 'example-diagram';
export const detector = (txt: string) => {
const detector = (txt: string) => {
return txt.match(/^\s*example-diagram/) !== null;
};
export const loadDiagram = async () => {
const loader = async () => {
const { diagram } = await import('./diagram-definition');
return { id, diagram };
};
const plugin: ExternalDiagramDefinition = {
id,
detector,
loader,
};
export default plugin;