chore(split): Info

This commit is contained in:
Sidharth Vinod
2022-11-18 16:10:15 +05:30
parent 25bc381361
commit f03364f328
2 changed files with 30 additions and 2 deletions

View File

@@ -1,5 +1,20 @@
import type { DiagramDetector } from '../../diagram-api/types'; import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';
export const infoDetector: DiagramDetector = (txt) => { const id = 'info';
const detector: DiagramDetector = (txt) => {
return txt.match(/^\s*info/) !== null; return txt.match(/^\s*info/) !== null;
}; };
const loader = async () => {
const { diagram } = await import('./infoDiagram');
return { id, diagram };
};
const plugin: ExternalDiagramDefinition = {
id,
detector,
loader,
};
export default plugin;

View File

@@ -0,0 +1,13 @@
import { DiagramDefinition } from '../../diagram-api/types';
// @ts-ignore: TODO Fix ts errors
import parser from './parser/info';
import db from './infoDb';
import styles from './styles';
import renderer from './infoRenderer';
export const diagram: DiagramDefinition = {
parser,
db,
renderer,
styles,
};