mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-14 22:09:29 +02:00
#6856 Exposing elk configuration forceNodeModelOrder and considerModelOrder to the mermaid configuration
This commit is contained in:
@@ -766,7 +766,10 @@ export const render = async (
|
||||
id: 'root',
|
||||
layoutOptions: {
|
||||
'elk.hierarchyHandling': 'INCLUDE_CHILDREN',
|
||||
'elk.layered.considerModelOrder.strategy': 'NODES_AND_EDGES',
|
||||
'elk.layered.crossingMinimization.forceNodeModelOrder':
|
||||
data4Layout.config.elk?.forceNodeModelOrder,
|
||||
'elk.layered.considerModelOrder.strategy': data4Layout.config.elk?.considerModelOrder,
|
||||
|
||||
'elk.algorithm': algorithm,
|
||||
'nodePlacement.strategy': data4Layout.config.elk?.nodePlacementStrategy,
|
||||
'elk.layered.mergeEdges': data4Layout.config.elk?.mergeEdges,
|
||||
|
@@ -109,6 +109,16 @@ export interface MermaidConfig {
|
||||
| 'INTERACTIVE'
|
||||
| 'MODEL_ORDER'
|
||||
| 'GREEDY_MODEL_ORDER';
|
||||
/**
|
||||
* The node order given by the model does not change to produce a better layout. E.g. if node A is before node B in the model this is not changed during crossing minimization. This assumes that the node model order is already respected before crossing minimization. This can be achieved by setting considerModelOrder.strategy to NODES_AND_EDGES.
|
||||
*
|
||||
*/
|
||||
forceNodeModelOrder?: boolean;
|
||||
/**
|
||||
* Preserves the order of nodes and edges in the model file if this does not lead to additional edge crossings. Depending on the strategy this is not always possible since the node and edge order might be conflicting.
|
||||
*
|
||||
*/
|
||||
considerModelOrder?: 'NONE' | 'NODES_AND_EDGES' | 'PREFER_EDGES' | 'PREFER_NODES';
|
||||
};
|
||||
darkMode?: boolean;
|
||||
htmlLabels?: boolean;
|
||||
|
@@ -24,6 +24,8 @@ const config: RequiredDeep<MermaidConfig> = {
|
||||
// mergeEdges is needed here to be considered
|
||||
mergeEdges: false,
|
||||
nodePlacementStrategy: 'BRANDES_KOEPF',
|
||||
forceNodeModelOrder: false,
|
||||
considerModelOrder: 'NODES_AND_EDGES',
|
||||
},
|
||||
themeCSS: undefined,
|
||||
|
||||
|
@@ -133,6 +133,21 @@ properties:
|
||||
- MODEL_ORDER
|
||||
- GREEDY_MODEL_ORDER
|
||||
default: GREEDY_MODEL_ORDER
|
||||
forceNodeModelOrder:
|
||||
description: |
|
||||
The node order given by the model does not change to produce a better layout. E.g. if node A is before node B in the model this is not changed during crossing minimization. This assumes that the node model order is already respected before crossing minimization. This can be achieved by setting considerModelOrder.strategy to NODES_AND_EDGES.
|
||||
type: boolean
|
||||
default: false
|
||||
considerModelOrder:
|
||||
description: |
|
||||
Preserves the order of nodes and edges in the model file if this does not lead to additional edge crossings. Depending on the strategy this is not always possible since the node and edge order might be conflicting.
|
||||
type: string
|
||||
enum:
|
||||
- NONE
|
||||
- NODES_AND_EDGES
|
||||
- PREFER_EDGES
|
||||
- PREFER_NODES
|
||||
default: 'NODES_AND_EDGES'
|
||||
darkMode:
|
||||
type: boolean
|
||||
default: false
|
||||
|
Reference in New Issue
Block a user