Skip to content

Commit 06bf21c

Browse files
committed
git add -ugit add -u support mermaid, althoght it not usefull
1 parent 3395f58 commit 06bf21c

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed

content/about.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
---
22
title : "About"
33
description : "Hugo, the world's fastest framework for building websites"
4-
date : "2019-02-28"
4+
date : "2020-03-28"
55
aliases : ["about-us", "about-hugo", "contact"]
66
author : "realzhangm"
7+
mermaid: true
78
---
89

10+
```mermaid
11+
journey
12+
title 我的一天
13+
section 上班
14+
有时开会: 3: 我,同事
15+
Coding: 5: 我
16+
项目流程: 2: 我
17+
section 下班
18+
看书: 5: 我
19+
上网: 5: 我
20+
```

layouts/_default/single.html

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{{ define "main" }}
2+
3+
<article class="post-single">
4+
<header class="post-title">
5+
<p>
6+
{{ if .Date }}
7+
<time>{{ .Date | time.Format ":date_medium" }}</time>
8+
{{ end }}
9+
{{ if or .Params.Author site.Author.name }}
10+
<span>{{ .Params.Author | default site.Author.name }}</span>
11+
{{ end }}
12+
</p>
13+
<h1>{{ .Title }}</h1>
14+
</header>
15+
<section class="post-content">{{ .Content }}</section>
16+
17+
<!-- Post Tags -->
18+
{{ if .Params.tags }}
19+
<footer class="post-tags">
20+
{{ range .Params.tags }} {{ $href := print (absURL "tags/") (urlize .) }}
21+
<a href="{{ $href }}">{{ . }}</a>
22+
{{ end }}
23+
</footer>
24+
{{ end }}
25+
26+
<!-- Post Nav -->
27+
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}<!---->
28+
{{ if and (gt (len $pages) 1) (in $pages . ) }}
29+
<nav class="post-nav">
30+
{{ with $pages.Next . }}
31+
<a class="prev" href="{{ .Permalink }}"><span></span><span>{{ .Name }}</span></a>
32+
{{ end }} {{ with $pages.Prev . }}
33+
<a class="next" href="{{ .Permalink }}"><span>{{ .Name }}</span><span></span></a>
34+
{{ end }}
35+
</nav>
36+
{{ end }}
37+
38+
<!-- Disqus -->
39+
{{ if and site.DisqusShortname (not (eq .Params.comments false)) }}
40+
<div id="disqus_thread" class="post-comments"></div>
41+
<script>
42+
var disqusShortname = '{{ site.DisqusShortname }}';
43+
var script = document.createElement('script');
44+
script.src = 'https://' + disqusShortname + '.disqus.com/embed.js';
45+
script.setAttribute('data-timestamp', +new Date());
46+
document.head.appendChild(script);
47+
</script>
48+
{{ end }}
49+
50+
<!-- Mermaid -->
51+
{{ if .Params.mermaid }}
52+
<script
53+
src="https://cdn.staticfile.org/mermaid/8.14.0/mermaid.min.js"
54+
integrity="md5-cb58961821ec1396e5c283dc07331efd"
55+
crossorigin="anonymous"
56+
></script>
57+
<script>
58+
// Replace mermaid pre.code to div
59+
Array.from(document.getElementsByClassName("language-mermaid")).forEach(
60+
(el) => {
61+
el.parentElement.outerHTML = `<div class="mermaid">${el.innerText}</div>`;
62+
}
63+
);
64+
</script>
65+
<style>
66+
/* Set svg to center */
67+
.mermaid svg {
68+
display: block;
69+
margin: auto;
70+
}
71+
</style>
72+
{{ end }}
73+
74+
</article>
75+
76+
{{ end }}

0 commit comments

Comments
 (0)