Skip to content

Commit cd4b382

Browse files
authored
Add jekyll-diagrams (alshedivat#333)
* Add mermaid support via jekyll-diagrams * Add mermaid install to deploy workflow
1 parent 6b0bf87 commit cd4b382

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

.github/workflows/deploy.yml

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
gem install bundler
3333
bundle config path vendor/bundle
3434
bundle install --jobs 4 --retry 3
35+
npm install -g mermaid.cli
3536
- name: Setup deploy options
3637
id: setup
3738
run: |

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
source 'https://rubygems.org'
22
group :jekyll_plugins do
33
gem 'jekyll'
4+
gem 'jekyll-diagrams'
45
gem 'jekyll-email-protect'
56
gem 'jekyll-feed'
67
gem 'jekyll-github-metadata'

_config.yml

+9
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ keep_files:
137137
# Plug-ins
138138
plugins:
139139
- jekyll/scholar
140+
- jekyll-diagrams
140141
- jekyll-email-protect
141142
- jekyll-feed
142143
- jekyll-github-metadata
@@ -178,6 +179,14 @@ scholar:
178179

179180
query: "@*"
180181

182+
# -----------------------------------------------------------------------------
183+
# Jekyll Diagrams
184+
# -----------------------------------------------------------------------------
185+
186+
jekyll-diagrams:
187+
# configuration, see https://github.com/zhustec/jekyll-diagrams.
188+
# feel free to comment out this section if not using jekyll diagrams.
189+
181190
# -----------------------------------------------------------------------------
182191
# Optional Features
183192
# -----------------------------------------------------------------------------

_posts/2021-07-04-diagrams.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
layout: post
3+
title: a post with diagrams
4+
date: 2021-07-04 17:39:00
5+
description: an example of a blog post with diagrams
6+
---
7+
8+
This theme supports generating various diagrams from a text description using [jekyll-diagrams](https://github.com/zhustec/jekyll-diagrams){:target="\_blank"} plugin.
9+
Below, we generate a few examples of such diagrams using languages such as [mermaid](https://mermaid-js.github.io/mermaid/){:target="\_blank"}, [plantuml](https://plantuml.com/){:target="\_blank"}, [vega-lite](https://vega.github.io/vega-lite/){:target="\_blank"}, etc.
10+
11+
**Note:** different diagram-generation packages require external dependencies to be installed on your machine.
12+
Also, be mindful of that because of diagram generation the fist time you build your Jekyll website after adding new diagrams will be SLOW.
13+
For any other details, please refer to [jekyll-diagrams](https://github.com/zhustec/jekyll-diagrams){:target="\_blank"} README.
14+
15+
16+
## Mermaid
17+
18+
Install mermaid using `node.js` package manager `npm` by running the following command:
19+
```bash
20+
npm install -g mermaid.cli
21+
```
22+
23+
The diagram below was generated by the following code:
24+
25+
{% raw %}
26+
```
27+
{% mermaid %}
28+
sequenceDiagram
29+
participant John
30+
participant Alice
31+
Alice->>John: Hello John, how are you?
32+
John-->>Alice: Great!
33+
{% endmermaid %}
34+
```
35+
{% endraw %}
36+
37+
{% mermaid %}
38+
sequenceDiagram
39+
participant John
40+
participant Alice
41+
Alice->>John: Hello John, how are you?
42+
John-->>Alice: Great!
43+
{% endmermaid %}

0 commit comments

Comments
 (0)