Adopt consistent, explicit identifier naming across diagrams and TypeScript APIs.
Rules 1) Diagram ids/syntax keywords
-beta to the syntax/keyword the parser accepts.Mini or extra suffixes like Language unless the codebase has a single established pattern).2) TypeScript naming style
DiagramStylesProvider).interface for object shapes when possible.3) Type-only files
.d.ts for internal project types..type.ts (e.g., gantt.type.ts).4) Exported fields/props
width/height over w/h) to improve readability for downstream users.5) Stability/compatibility for naming formats
Example
// diagram detector keyword
const detector: DiagramDetector = (txt) => /^\s*contextMap-beta/.test(txt);
// stable diagram config key naming: one established pattern
export interface MermaidConfig {
contextMap?: MiniContextMapLanguageDiagramConfig; // avoid “Mini…Language…” unless consistent everywhere
}
// type-only file convention
// packages/mermaid/src/diagrams/gantt/gantt.type.ts
export type DiagramStylesProvider = (options?: Record<string, unknown>) => string;
// explicit fields
export interface NodeMetaData {
width?: string;
height?: string;
}
Enter the URL of a public GitHub repository