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

Add Mermaid support #369

Merged
merged 11 commits into from
Jul 5, 2021
Merged

Add Mermaid support #369

merged 11 commits into from
Jul 5, 2021

Conversation

h-enk
Copy link
Member

@h-enk h-enk commented Jul 2, 2021

Features

  • Use shortcode
  • Use code fences
  • Uses Doks default font Jost
  • Mermaid script is only loaded on pages that need it
  • No conflicts w/ highlight.js + clipboard
  • No Content Security Policy conflicts
  • Shows error message when mermaid = true is not set

Enable

Mermaid support is switched off per default. For performance reasons, the script is only loaded on pages that need it (so, not site wide). Activate it by setting mermaid = true in the front matter of a page.

Shortcode

{{< mermaid class="bg-light text-center" >}}
graph TD
  A[Hard] -->|Text| B(Round)
  B --> C{Decision}
  C -->|One| D[Result 1]
  C -->|Two| E[Result 2]
{{< /mermaid >}}

Note that, you can add Bootstrap classes to the shortcode, for e.g. aligning the graph or setting the background color.

mermaid-shortcode

Code fences

```mermaid
graph TD
  A[Hard] -->|Text| B(Round)
  B --> C{Decision}
  C -->|One| D[Result 1]
  C -->|Two| E[Result 2]
```

mermaid-code-fences

Documentation

See: https://getdoks.org/docs/extensions/mermaid/

@h-enk h-enk added this to the v0.3.1 milestone Jul 2, 2021
@h-enk h-enk added the enhancement New feature or request label Jul 2, 2021
@h-enk h-enk merged commit 86160f3 into master Jul 5, 2021
@h-enk h-enk deleted the mermaid branch July 5, 2021 07:55
adhadse pushed a commit to adhadse/doks that referenced this pull request Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant