mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 16:29:40 +02:00
standardize detector function definition with DiagramDetector
type
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
|
||||||
const id = 'c4';
|
const id = 'c4';
|
||||||
|
|
||||||
const detector = (txt: string) => {
|
const detector: DiagramDetector = (txt) => {
|
||||||
return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);
|
return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
import type { MermaidConfig } from '../../../config.type.js';
|
|
||||||
import type { ExternalDiagramDefinition, DiagramDetector } from '../../../diagram-api/types.js';
|
import type { ExternalDiagramDefinition, DiagramDetector } from '../../../diagram-api/types.js';
|
||||||
|
|
||||||
const id = 'flowchart-elk';
|
const id = 'flowchart-elk';
|
||||||
|
|
||||||
const detector: DiagramDetector = (txt: string, config?: MermaidConfig): boolean => {
|
const detector: DiagramDetector = (txt, config): boolean => {
|
||||||
if (
|
if (
|
||||||
// If diagram explicitly states flowchart-elk
|
// If diagram explicitly states flowchart-elk
|
||||||
/^\s*flowchart-elk/.test(txt) ||
|
/^\s*flowchart-elk/.test(txt) ||
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
const id = 'mindmap';
|
const id = 'mindmap';
|
||||||
|
|
||||||
const detector = (txt: string) => {
|
const detector: DiagramDetector = (txt) => {
|
||||||
return /^\s*mindmap/.test(txt);
|
return /^\s*mindmap/.test(txt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
|
||||||
const id = 'timeline';
|
const id = 'timeline';
|
||||||
|
|
||||||
const detector = (txt: string) => {
|
const detector: DiagramDetector = (txt) => {
|
||||||
return /^\s*timeline/.test(txt);
|
return /^\s*timeline/.test(txt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user