Skip to content

Commit 3017301

Browse files
committed
Introduce the mermaid in docs
1 parent 706275b commit 3017301

2 files changed

Lines changed: 91 additions & 16 deletions

File tree

_posts/2019-08-08-text-and-typography.md

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@ date: 2019-08-08 11:33:00 +0800
55
categories: [Blogging, Demo]
66
tags: [typography]
77
math: true
8+
mermaid: true
89
image: /assets/img/sample/devices-mockup.png
910
---
1011

1112
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
1213

1314

1415
## Titles
15-
1616
---
17+
# H1 - heading
1718

18-
# H1
19-
20-
<h2 data-toc-skip>H2</h2>
21-
22-
<h3 data-toc-skip>H3</h3>
19+
<h2 data-toc-skip>H2 - heading</h2>
2320

24-
<h4>H4</h4>
21+
<h3 data-toc-skip>H3 - heading</h3>
2522

23+
<h4>H4 - heading</h4>
2624
---
25+
<br>
2726

2827
## Paragraph
2928

@@ -79,32 +78,50 @@ Click the hook will locate the footnote[^footnote].
7978

8079
## Images
8180

82-
By default, the image is centered and the image caption can be displayed at the bottom:
81+
- Default (with caption)
8382

8483
![Desktop View](/assets/img/sample/mockup.png)
8584
_Full screen width and center alignment_
8685

87-
You can change the size of the picture:
86+
<br>
87+
88+
- Specify width
8889

8990
![Desktop View](/assets/img/sample/mockup.png){: width="400"}
9091
_400px image width_
9192

92-
In addition, you can use class `normal` , `left` and `right` to specify the image position (but in these case, the image caption is prohibited), for example:
93+
<br>
94+
95+
- Left aligned
96+
97+
![Desktop View](/assets/img/sample/mockup.png){: width="350" class="normal"}
9398

94-
- Normal position
95-
96-
![Desktop View](/assets/img/sample/mockup.png){: width="350" class="normal"}
99+
<br>
97100

98-
- Float to the left
101+
- Float to left
99102

100103
![Desktop View](/assets/img/sample/mockup.png){: width="240" class="left"}
101104
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
102105

103-
- Float to the right
106+
<br>
107+
108+
- Float to right
104109

105110
![Desktop View](/assets/img/sample/mockup.png){: width="240" class="right"}
106111
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
107112

113+
<br>
114+
115+
## Mermaid SVG
116+
117+
```mermaid
118+
gantt
119+
title Adding GANTT diagram functionality to mermaid
120+
apple :a, 2017-07-20, 1w
121+
banana :crit, b, 2017-07-23, 1d
122+
cherry :active, c, after b a, 1d
123+
```
124+
108125
## Inline code
109126

110127
This is an example of `Inline Code`.

_posts/2019-08-08-write-a-new-post.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,22 @@ math: true
6868
---
6969
```
7070

71-
## Preview Image
71+
## Mermaid
72+
73+
[**Mermaid**](https://github.com/mermaid-js/mermaid) is a great diagrams generation tool. To enable it on your post, add the following to the YAML block:
74+
75+
```yml
76+
---
77+
mermaid: true
78+
---
79+
```
80+
81+
Then you can use it like other markdown language: surround the graph code with <code class="language-plaintext highlighter-rouge">```mermaid</code>
82+
and <code class="language-plaintext highlighter-rouge">```</code>.
83+
84+
## Images
85+
86+
### Preview image
7287

7388
If you want to add an image to the top of the post contents, specify the url for the image by:
7489

@@ -78,6 +93,49 @@ image: /path/to/image-file
7893
---
7994
```
8095

96+
### Image caption
97+
98+
Add italics to the next line of an image,then it will become the caption and appear at the bottom of the image:
99+
100+
```markdown
101+
![img-description](/path/to/image)
102+
_Image Caption_
103+
```
104+
105+
### Image size
106+
107+
You can specify the width (and height) of a image with `width`:
108+
109+
```markdown
110+
![Desktop View](/assets/img/sample/mockup.png){: width="400"}
111+
```
112+
113+
### Image position
114+
115+
By default, the image is centered, but you can specify the position by using one of class `normal` , `left` and `right`. For example:
116+
117+
- **Normal position**
118+
119+
Image will be left aligned in below sample:
120+
121+
```markdown
122+
![Desktop View](/assets/img/sample/mockup.png){: width="350" class="normal"}
123+
```
124+
125+
- **Float to the left**
126+
127+
```markdown
128+
![Desktop View](/assets/img/sample/mockup.png){: width="240" class="left"}
129+
```
130+
131+
- **Float to the right**
132+
133+
```markdown
134+
![Desktop View](/assets/img/sample/mockup.png){: width="240" class="right"}
135+
```
136+
137+
> **Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
138+
81139
## Pinned Posts
82140

83141
You can pin one or more posts to the top of the home page, and the fixed posts are sorted in reverse order according to their release date. Enable by:

0 commit comments

Comments
 (0)