mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 08:50:13 +02:00
fix: Return type, make config non optional
Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
@@ -49,7 +49,7 @@ const processDirectives = (code: string) => {
|
|||||||
* @param code - The code to preprocess.
|
* @param code - The code to preprocess.
|
||||||
* @returns The object containing the preprocessed code, title, and configuration.
|
* @returns The object containing the preprocessed code, title, and configuration.
|
||||||
*/
|
*/
|
||||||
export function preprocessDiagram(code: string): DiagramMetadata & { code: string } {
|
export function preprocessDiagram(code: string) {
|
||||||
const cleanedCode = cleanupText(code);
|
const cleanedCode = cleanupText(code);
|
||||||
const frontMatterResult = processFrontmatter(cleanedCode);
|
const frontMatterResult = processFrontmatter(cleanedCode);
|
||||||
const directiveResult = processDirectives(frontMatterResult.text);
|
const directiveResult = processDirectives(frontMatterResult.text);
|
||||||
@@ -59,5 +59,5 @@ export function preprocessDiagram(code: string): DiagramMetadata & { code: strin
|
|||||||
code,
|
code,
|
||||||
title: frontMatterResult.title,
|
title: frontMatterResult.title,
|
||||||
config,
|
config,
|
||||||
};
|
} satisfies DiagramMetadata & { code: string };
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,7 @@ export interface ParseResult {
|
|||||||
/**
|
/**
|
||||||
* The config passed as YAML frontmatter or directives
|
* The config passed as YAML frontmatter or directives
|
||||||
*/
|
*/
|
||||||
config?: MermaidConfig;
|
config: MermaidConfig;
|
||||||
}
|
}
|
||||||
// This makes it clear that we're working with a d3 selected element of some kind, even though it's hard to specify the exact type.
|
// This makes it clear that we're working with a d3 selected element of some kind, even though it's hard to specify the exact type.
|
||||||
export type D3Element = any;
|
export type D3Element = any;
|
||||||
|
Reference in New Issue
Block a user