standardize detector function definition with `DiagramDetector` type
This commit is contained in:
parent
e688138167
commit
6ced1673b0
|
@ -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 detector = (txt: string) => {
|
||||
const detector: DiagramDetector = (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';
|
||||
|
||||
const id = 'flowchart-elk';
|
||||
|
||||
const detector: DiagramDetector = (txt: string, config?: MermaidConfig): boolean => {
|
||||
const detector: DiagramDetector = (txt, config): boolean => {
|
||||
if (
|
||||
// If diagram explicitly states flowchart-elk
|
||||
/^\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 detector = (txt: string) => {
|
||||
const detector: DiagramDetector = (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 detector = (txt: string) => {
|
||||
const detector: DiagramDetector = (txt) => {
|
||||
return /^\s*timeline/.test(txt);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue