feat: support mermaid codeblocks (#485)
This commit is contained in:
parent
53ab130467
commit
12c81554ac
6 changed files with 48 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
|||
/exampleSite/public/
|
||||
/exampleSite/config/development/
|
||||
CHANGELOG.md
|
||||
VERSION
|
||||
|
||||
# translation envs
|
||||
exampleSite/content/de
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Geekdoc
|
||||
|
||||
[![Build Status](https://img.shields.io/drone/build/thegeeklab/hugo-geekdoc?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/hugo-geekdoc)
|
||||
[![Hugo Version](https://img.shields.io/badge/hugo-0.83-blue.svg)](https://gohugo.io)
|
||||
[![Hugo Version](https://img.shields.io/badge/hugo-0.93-blue.svg)](https://gohugo.io)
|
||||
[![GitHub release](https://img.shields.io/github/v/release/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/releases/latest)
|
||||
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/graphs/contributors)
|
||||
[![License: MIT](https://img.shields.io/github/license/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/blob/main/LICENSE)
|
||||
|
|
|
@ -9,7 +9,7 @@ geekdocAnchor: false
|
|||
<!-- markdownlint-disable MD033 -->
|
||||
|
||||
<span class="badge-placeholder">[![Build Status](https://img.shields.io/drone/build/thegeeklab/hugo-geekdoc?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/hugo-geekdoc)</span>
|
||||
<span class="badge-placeholder">[![Hugo Version](https://img.shields.io/badge/hugo-0.83-blue.svg)](https://gohugo.io)</span>
|
||||
<span class="badge-placeholder">[![Hugo Version](https://img.shields.io/badge/hugo-0.93-blue.svg)](https://gohugo.io)</span>
|
||||
<span class="badge-placeholder">[![GitHub release](https://img.shields.io/github/v/release/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/releases/latest)</span>
|
||||
<span class="badge-placeholder">[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/graphs/contributors)</span>
|
||||
<span class="badge-placeholder">[![License: MIT](https://img.shields.io/github/license/thegeeklab/hugo-geekdoc)](https://github.com/thegeeklab/hugo-geekdoc/blob/main/LICENSE)</span>
|
||||
|
|
|
@ -44,3 +44,36 @@ sequenceDiagram
|
|||
<!-- spellchecker-enable -->
|
||||
|
||||
{{< /columns >}}
|
||||
|
||||
As an alternative to shortcodes, code blocks can be used for markdown as well.
|
||||
|
||||
{{< columns >}}
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
````tpl
|
||||
```mermaid
|
||||
flowchart LR
|
||||
|
||||
A[Hard] -->|Text| B(Round)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result 1]
|
||||
C -->|Two| E[Result 2]
|
||||
```
|
||||
````
|
||||
|
||||
<--->
|
||||
|
||||
<!-- spellchecker-disable -->
|
||||
<!-- prettier-ignore -->
|
||||
```mermaid
|
||||
flowchart LR
|
||||
|
||||
A[Hard] -->|Text| B(Round)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result 1]
|
||||
C -->|Two| E[Result 2]
|
||||
```
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
{{< /columns >}}
|
||||
|
|
11
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
11
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!-- prettier-ignore-start -->
|
||||
{{ if not (.Page.Scratch.Get "mermaid") }}
|
||||
<!-- Include mermaid only first time -->
|
||||
<script defer src="{{ index (index .Site.Data.assets "mermaid.js") "src" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "mermaid" true }}
|
||||
{{ end }}
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<pre class="gdoc-mermaid mermaid">
|
||||
{{- .Inner -}}
|
||||
</pre>
|
|
@ -5,7 +5,7 @@ description = "Hugo theme made for documentation"
|
|||
homepage = "https://geekdocs.de/"
|
||||
demosite = "https://geekdocs.de/"
|
||||
tags = ["docs", "documentation", "responsive", "simple"]
|
||||
min_version = "0.83.0"
|
||||
min_version = "0.93.0"
|
||||
|
||||
[author]
|
||||
name = "Robert Kaussow"
|
||||
|
|
Loading…
Reference in a new issue