Skip to content

Commit

Permalink
fix(view:codeblock:mermaid): %% init can't have spaces in between
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Apr 28, 2024
1 parent 2876bcd commit 5624e60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/utils/mermaid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
];

Expand Down
8 changes: 4 additions & 4 deletions tests/utils/mermaid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -31,7 +31,7 @@ flowchart LR
}).trim(),
).toBe(
`
%% { init: { "flowchart": {"defaultRenderer":"elk"} } } %%
%%{ init: { "flowchart": {"defaultRenderer":"elk"} } }%%
graph TB
\t0("a.md")
\t1("b.md")
Expand All @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 5624e60

Please sign in to comment.