diff --git a/src/utils/mermaid.ts b/src/utils/mermaid.ts index cd4b3029..c61e43c2 100644 --- a/src/utils/mermaid.ts +++ b/src/utils/mermaid.ts @@ -89,7 +89,7 @@ const from_edges = ( const lines = [ // NOTE: Regardless of kind, the below field should always be flowchart - `%% { init: { "flowchart": ${JSON.stringify(flowchart_init)} } } %%`, + `%%{ init: { "flowchart": ${JSON.stringify(flowchart_init)} } }%%`, `${resolved.kind} ${resolved.direction}`, ]; diff --git a/tests/utils/mermaid.test.ts b/tests/utils/mermaid.test.ts index d9812612..8d4f8ac5 100644 --- a/tests/utils/mermaid.test.ts +++ b/tests/utils/mermaid.test.ts @@ -11,7 +11,7 @@ describe("from_edges", () => { test("!config", (t) => { t.expect(Mermaid.from_edges(edges).trim()).toBe( ` -%% { init: { "flowchart": {} } } %% +%%{ init: { "flowchart": {} } }%% flowchart LR \t0("a.md") \t1("b.md") @@ -31,7 +31,7 @@ flowchart LR }).trim(), ).toBe( ` -%% { init: { "flowchart": {"defaultRenderer":"elk"} } } %% +%%{ init: { "flowchart": {"defaultRenderer":"elk"} } }%% graph TB \t0("a.md") \t1("b.md") @@ -47,7 +47,7 @@ graph TB Mermaid.from_edges(edges, { show_attributes: ["field"] }).trim(), ).toBe( ` -%% { init: { "flowchart": {} } } %% +%%{ init: { "flowchart": {} } }%% flowchart LR \t0("a.md") \t1("b.md") @@ -63,7 +63,7 @@ flowchart LR Mermaid.from_edges(edges, { click: { method: "class" } }).trim(), ).toBe( ` -%% { init: { "flowchart": {} } } %% +%%{ init: { "flowchart": {} } }%% flowchart LR \t0("a.md") \t1("b.md")