yzane / vscode-markdown-pdf

Markdown converter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf
Other
1.01k stars 206 forks source link

support for mermaid containers #277

Open krajniks opened 2 years ago

krajniks commented 2 years ago

This adds support for mermaid diagrams inside containers, for example:

::: mermaid
stateDiagram
    [*] --> First
    state First {
        [*] --> second
        second --> [*]
    }
:::

This is implemented on Azure wiki. https://docs.microsoft.com/en-us/azure/devops/project/wiki/wiki-markdown-guidance?view=azure-devops#add-mermaid-diagrams-to-a-wiki-page

Code was transfered from https://github.com/mjbvz/vscode-markdown-mermaid

I have also updated a mermaid.png, as it renders differently.

yodapotatofly commented 2 years ago

I don't quite see the benefits of that since mermaid is already supported in standard code blocks :

```mermaid
graph LR;
    A[Hard edge] -->|Link text| B(Round edge) --> C{Decision}
    C -->|One| D[Result one]
    C -->|Two| E[Result two]
```

will appear in the pdf as

graph LR;
    A[Hard edge] -->|Link text| B(Round edge) --> C{Decision}
    C -->|One| D[Result one]
    C -->|Two| E[Result two]
krajniks commented 2 years ago

this was requested due to support for Azure DevOps Wiki, as there mermaid is supported only in containers, but not in code blocks. This would then allow markdown-pdf to also render these markdowns to pdf with correct mermaid rendering. Does that make more sense?

image