diff --git a/.cspell/code-terms.txt b/.cspell/code-terms.txt index 9d2f700fc..6d6dad045 100644 --- a/.cspell/code-terms.txt +++ b/.cspell/code-terms.txt @@ -120,6 +120,8 @@ SUBROUTINEEND SUBROUTINESTART Subschemas substr +SVGG +SVGSVG TAGEND TAGSTART techn diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html index 269ee0f0e..8808a3c9d 100644 --- a/cypress/platform/knsv2.html +++ b/cypress/platform/knsv2.html @@ -84,17 +84,20 @@
 ---
-config:
-  look: handDrawn
-  layout: elk
-  elk:
+  title: hello2
+  config:
+    look: handDrawn
+    layout: elk
+    elk:
         nodePlacementStrategy: BRANDES_KOEPF
 ---
-flowchart TB
-    %% A --> C
-    B -- sdf sdf --> C{"Evaluate"}
-    C --> n4["salkdfjh akljd lkasdjf lkashj lksjadf klasdh"]
-    C --> F
+flowchart LR
+  A[Start] --Some text--> B(Continue)
+  B --> C{Evaluate}
+  C -- One --> D[Option 1]
+  C -- Two --> E[Option 2]
+  C -- Three --> F[fa:fa-car Option 3]
+
 
 
 
{ +export const getDiagramElement = (id, securityLevel) => { let sandboxElement; if (securityLevel === 'sandbox') { sandboxElement = select('#i' + id); @@ -15,9 +15,7 @@ export const getDiagramElements = (id, securityLevel) => { // Run the renderer. This is what draws the final graph. - // @ts-ignore todo: fix this - const element = root.select('#' + id + ' g'); - return { svg, element }; + return svg; }; export function insertElementsForSize(el, data) { diff --git a/packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js b/packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js index 8851a1d95..2717eb717 100644 --- a/packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js +++ b/packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js @@ -268,7 +268,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit return { elem, diff }; }; -export const render = async (data4Layout, svg, element) => { +export const render = async (data4Layout, svg) => { const graph = new graphlib.Graph({ multigraph: true, compound: true, @@ -289,7 +289,7 @@ export const render = async (data4Layout, svg, element) => { .setDefaultEdgeLabel(function () { return {}; }); - + const element = svg.select('g'); insertMarkers(element, data4Layout.markers, data4Layout.type, data4Layout.diagramId); clearNodes(); clearEdges(); diff --git a/packages/mermaid/src/rendering-util/render.ts b/packages/mermaid/src/rendering-util/render.ts index 8b28fe82b..013be7ba4 100644 --- a/packages/mermaid/src/rendering-util/render.ts +++ b/packages/mermaid/src/rendering-util/render.ts @@ -12,7 +12,6 @@ export interface LayoutAlgorithm { render( layoutData: LayoutData, svg: SVG, - element: any, helpers: InternalHelpers, options?: RenderOptions ): Promise; @@ -45,14 +44,14 @@ const registerDefaultLayoutLoaders = () => { registerDefaultLayoutLoaders(); -export const render = async (data4Layout: LayoutData, svg: SVG, element: any) => { +export const render = async (data4Layout: LayoutData, svg: SVG) => { if (!(data4Layout.layoutAlgorithm in layoutAlgorithms)) { throw new Error(`Unknown layout algorithm: ${data4Layout.layoutAlgorithm}`); } const layoutDefinition = layoutAlgorithms[data4Layout.layoutAlgorithm]; const layoutRenderer = await layoutDefinition.loader(); - return layoutRenderer.render(data4Layout, svg, element, internalHelpers, { + return layoutRenderer.render(data4Layout, svg, internalHelpers, { algorithm: layoutDefinition.algorithm, }); };