Skip to content

Commit

Permalink
#5782 fix: adding backwards compatability for defaultRenderer directive
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Aug 28, 2024
1 parent 8c8ed57 commit 011c036
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions packages/mermaid/src/diagrams/flowchart/flowDetector-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import type {
const id = 'flowchart-v2';

const detector: DiagramDetector = (txt, config) => {
if (
config?.flowchart?.defaultRenderer === 'dagre-d3' ||
config?.flowchart?.defaultRenderer === 'elk'
) {
if (config?.flowchart?.defaultRenderer === 'dagre-d3') {
return false;
}

if (config?.flowchart?.defaultRenderer === 'elk') {
config.layout = 'elk';
}

// If we have configured to use dagre-wrapper then we should return true in this function for graph code thus making it use the new flowchart diagram
if (/^\s*graph/.test(txt) && config?.flowchart?.defaultRenderer === 'dagre-wrapper') {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
if (graph.children(v).length > 0) {
// This is a cluster but not to be rendered recursively
// Render as before
log.info(
log.trace(
'Cluster - the non recursive path XBX',
v,
node.id,
Expand All @@ -120,11 +120,11 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
'Graph:',
graph
);
log.info(findNonClusterChild(node.id, graph));
log.trace(findNonClusterChild(node.id, graph));
clusterDb.set(node.id, { id: findNonClusterChild(node.id, graph), node });
// insertCluster(clusters, graph.node(v));
} else {
log.warn('Node - the non recursive path XAX', v, nodes, graph.node(v), dir);
log.trace('Node - the non recursive path XAX', v, nodes, graph.node(v), dir);
await insertNode(nodes, graph.node(v), dir);
}
}
Expand Down

0 comments on commit 011c036

Please sign in to comment.