fix: cose-bilkent as the default layout for mindmaps

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
darshanr0107
2025-08-20 21:00:27 +05:30
parent c88f74a6ee
commit 61d9143acb
3 changed files with 21 additions and 5 deletions

View File

@@ -3,7 +3,10 @@ import { imgSnapshotTest } from '../../helpers/util.ts';
describe('Mindmap Tidy Tree', () => { describe('Mindmap Tidy Tree', () => {
it('1-tidy-tree: should render a simple mindmap without children', () => { it('1-tidy-tree: should render a simple mindmap without children', () => {
imgSnapshotTest( imgSnapshotTest(
` ` ---
config:
layout: tidy-tree
---
mindmap mindmap
root((mindmap)) root((mindmap))
A A
@@ -13,7 +16,10 @@ describe('Mindmap Tidy Tree', () => {
}); });
it('2-tidy-tree: should render a simple mindmap', () => { it('2-tidy-tree: should render a simple mindmap', () => {
imgSnapshotTest( imgSnapshotTest(
` ` ---
config:
layout: tidy-tree
---
mindmap mindmap
root((mindmap is a long thing)) root((mindmap is a long thing))
A A
@@ -25,7 +31,10 @@ describe('Mindmap Tidy Tree', () => {
}); });
it('3-tidy-tree: should render a mindmap with different shapes', () => { it('3-tidy-tree: should render a mindmap with different shapes', () => {
imgSnapshotTest( imgSnapshotTest(
` ` ---
config:
layout: tidy-tree
---
mindmap mindmap
root((mindmap)) root((mindmap))
Origins Origins
@@ -49,7 +58,10 @@ describe('Mindmap Tidy Tree', () => {
}); });
it('4-tidy-tree: should render a mindmap with children', () => { it('4-tidy-tree: should render a mindmap with children', () => {
imgSnapshotTest( imgSnapshotTest(
` ` ---
config:
layout: tidy-tree
---
mindmap mindmap
((This is a mindmap)) ((This is a mindmap))
child1 child1

View File

@@ -362,6 +362,10 @@
<hr /> <hr />
<script type="module"> <script type="module">
import mermaid from '/mermaid.esm.mjs'; import mermaid from '/mermaid.esm.mjs';
import tidytree from '/mermaid-layout-tidy-tree.esm.mjs';
import layouts from './mermaid-layout-elk.esm.mjs';
mermaid.registerLayoutLoaders(layouts);
mermaid.registerLayoutLoaders(tidytree);
mermaid.initialize({ mermaid.initialize({
theme: 'default', theme: 'default',
logLevel: 3, logLevel: 3,

View File

@@ -29,7 +29,7 @@ const processFrontmatter = (code: string) => {
config.gantt.displayMode = displayMode; config.gantt.displayMode = displayMode;
} }
if (diagramType === 'mindmap' && !config.layout) { if (diagramType === 'mindmap' && !config.layout) {
config.layout = 'tidy-tree'; config.layout = 'cose-bilkent'; // Default layout for mindmap
} }
return { title, config, text }; return { title, config, text };
}; };