Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: ignores mermaid directives and YAML config #217

Open
bguiz opened this issue Mar 28, 2023 · 3 comments
Open

bug: ignores mermaid directives and YAML config #217

bguiz opened this issue Mar 28, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@bguiz
Copy link

bguiz commented Mar 28, 2023

Describe the bug

  • When using a mermaid code block that includes a comment for a directive, advanced slides renders ignores that directive
  • When using a mermaid code block, and a YAML config for mermaid, advanced slides renders ignores the mermaid config

Samples to Reproduce

This mermaid code block:

```mermaid
%%{init: { 'gitGraph': {'showBranches': false}} }%%
gitGraph
	commit id: "foo"
	commit id: "bar" type: HIGHLIGHT
	commit id: "baz"
```

renders the same as this:

```mermaid
gitGraph
	commit id: "foo"
	commit id: "bar" type: HIGHLIGHT
	commit id: "baz"
```

Essentially the mermaid directive for init.gitGraph.showBranches is ignored.

Also attempted to solve this in the YAML frontmatter,
which I guessed may work if applied globally, to no avail:

---
transition: none
mermaid:
  init:
    gitGraph:
      showBranches: false
---

All of the above attempts render like this:
actual behaviour screen shot

Expected behavior

I expect it to render like this, when init.gitGraph.showBranches=false

expected behaviour screen shot

mermaid live editor example

@bguiz bguiz added the bug Something isn't working label Mar 28, 2023
@qrkourier
Copy link

I see the same thing. Removing the comment %% Add more tasks as necessary in this Mermaid.js block allows Advanced Slides to render it correctly, but with the comment, I get this error.

Parse error on line 18: ...lors of the sectionssection Installatio -----------------------^ Expecting 'taskData', got 'NL'

    ```mermaid
gantt
    title share obsidian notes with zrok

    dateFormat  YYYY-MM-DD
    axisFormat  %m-%d

    section Installation
    Install cross-platform zrok install with Obsidian plugin              :done,    install10, 2023-04-01, 1d
    
    section Public Share
    Share entire vault                            :done,    public10, after install10, 1d
    Share exports folder                          :done,    public15, after public10, 1d
    Share selected folder                         :done,    public20, after public15, 1d
    Share selected note                           :done,    public30, after public20, 1d
    
    section Private Share
    Set up private share with authentication      :done,    private10, after public30, 2d
    
    %% Add more tasks as necessary

    %% Set the colors of the sections
    section Installation   #ff8080
    section Public Share   #ffc166
    section Private Share  #83c995
    ```

@stannynuytkens
Copy link

This is something essential for me to work out more advanced git graphs. The directives only work outside this (awesome) plugin!

@bentimms
Copy link

For anyone in the same situation, the issue here is that you don't need the init level in the YAML front matter, for example, this works:

---
transition: none
mermaid:
  gitGraph:
    showBranches: false
---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants