mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
chore(split): gitGraph
This commit is contained in:
parent
38e5c3a81e
commit
25bc381361
@ -1,5 +1,21 @@
|
||||
import type { DiagramDetector } from '../../diagram-api/types';
|
||||
import type { ExternalDiagramDefinition } from '../../diagram-api/types';
|
||||
|
||||
export const gitGraphDetector: DiagramDetector = (txt) => {
|
||||
const id = 'gitGraph';
|
||||
|
||||
const detector: DiagramDetector = (txt) => {
|
||||
return txt.match(/^\s*gitGraph/) !== null;
|
||||
};
|
||||
|
||||
const loader = async () => {
|
||||
const { diagram } = await import('./gitGraphDiagram');
|
||||
return { id, diagram };
|
||||
};
|
||||
|
||||
const plugin: ExternalDiagramDefinition = {
|
||||
id,
|
||||
detector,
|
||||
loader,
|
||||
};
|
||||
|
||||
export default plugin;
|
||||
|
13
packages/mermaid/src/diagrams/git/gitGraphDiagram.ts
Normal file
13
packages/mermaid/src/diagrams/git/gitGraphDiagram.ts
Normal file
@ -0,0 +1,13 @@
|
||||
// @ts-ignore: TODO Fix ts errors
|
||||
import gitGraphParser from './parser/gitGraph';
|
||||
import gitGraphDb from './gitGraphAst';
|
||||
import gitGraphRenderer from './gitGraphRenderer';
|
||||
import gitGraphStyles from './styles';
|
||||
import { DiagramDefinition } from '../../diagram-api/types';
|
||||
|
||||
export const diagram: DiagramDefinition = {
|
||||
parser: gitGraphParser,
|
||||
db: gitGraphDb,
|
||||
renderer: gitGraphRenderer,
|
||||
styles: gitGraphStyles,
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user