Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thegeeklab/hugo-geekdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Kaussow <mail@thegeeklab.de>2022-08-29 22:52:44 +0300
committerGitHub <noreply@github.com>2022-08-29 22:52:44 +0300
commit12c81554ac8949c2e6aba96836141adf826a8c44 (patch)
tree88ab2eb2636f42f2276c66b09e19628d4f309be5
parent53ab130467d57f1be27f88e82aadd43f55c77b24 (diff)
feat: support mermaid codeblocks (#485)
-rw-r--r--.gitignore1
-rw-r--r--README.md2
-rw-r--r--exampleSite/content/en/_index.md2
-rw-r--r--exampleSite/content/en/shortcodes/mermaid.md33
-rw-r--r--layouts/_default/_markup/render-codeblock-mermaid.html11
-rw-r--r--theme.toml2
6 files changed, 48 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 2042e76..f36f822 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
/exampleSite/public/
/exampleSite/config/development/
CHANGELOG.md
+VERSION
# translation envs
exampleSite/content/de
diff --git a/README.md b/README.md
index 3b67dda..45691ef 100644
--- a/README.md
+++ b/README.md
@@ -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)
diff --git a/exampleSite/content/en/_index.md b/exampleSite/content/en/_index.md
index f07ec42..36934df 100644
--- a/exampleSite/content/en/_index.md
+++ b/exampleSite/content/en/_index.md
@@ -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>
diff --git a/exampleSite/content/en/shortcodes/mermaid.md b/exampleSite/content/en/shortcodes/mermaid.md
index 5ef14b9..ac98087 100644
--- a/exampleSite/content/en/shortcodes/mermaid.md
+++ b/exampleSite/content/en/shortcodes/mermaid.md
@@ -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 >}}
diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html
new file mode 100644
index 0000000..d3545db
--- /dev/null
+++ b/layouts/_default/_markup/render-codeblock-mermaid.html
@@ -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>
diff --git a/theme.toml b/theme.toml
index 3e5fe36..16a935e 100644
--- a/theme.toml
+++ b/theme.toml
@@ -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"