tidy-tree as the default layout for mindmaps

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
darshanr0107
2025-07-21 18:41:18 +05:30
parent f0445b74d1
commit cd6f8e5a24

View File

@@ -1,4 +1,5 @@
import { cleanupComments } from './diagram-api/comments.js';
import { detectType } from './diagram-api/detectType.js';
import { extractFrontMatter } from './diagram-api/frontmatter.js';
import type { DiagramMetadata } from './diagram-api/types.js';
import utils, { cleanAndMerge, removeDirectives } from './utils.js';
@@ -18,6 +19,7 @@ const cleanupText = (code: string) => {
const processFrontmatter = (code: string) => {
const { text, metadata } = extractFrontMatter(code);
const diagramType = detectType(text);
const { displayMode, title, config = {} } = metadata;
if (displayMode) {
// Needs to be supported for legacy reasons
@@ -26,6 +28,9 @@ const processFrontmatter = (code: string) => {
}
config.gantt.displayMode = displayMode;
}
if (diagramType === 'mindmap' && !config.layout) {
config.layout = 'tidy-tree';
}
return { title, config, text };
};