Merge pull request #62 from Junyi-99/develop

Develop
This commit is contained in:
Junyi 2024-09-11 12:09:18 +08:00 committed by GitHub
commit d9b7678e64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 170 additions and 21 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chart-histogram"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 3v18h18" /><path d="M20 18v3" /><path d="M16 16v5" /><path d="M12 13v8" /><path d="M8 16v5" /><path d="M3 11c6 0 5 -5 9 -5s3 5 9 5" /></svg>

After

Width:  |  Height:  |  Size: 468 B

View File

@ -0,0 +1,110 @@
+++
author = "Hugo Authors"
title = "Demo - Support for Diagrams"
date = "2024-05-06"
description = "Guide to advanced usage of Anubis2"
tags = [
"emoji",
]
+++
Feel free to switch between the light and dark themes to see how the diagram adapts its colors accordingly.
## Mermaid Diagrams
```mermaid
gantt
title A Gantt Diagram
dateFormat YYYY-MM-DD
section Section
A task :a1, 2014-01-01, 30d
Another task :after a1, 20d
section Another
Task in Another :2014-01-12, 12d
another task :24d
```
Get more examples at [About Mermaid](https://mermaid.js.org/intro/)
<!--more-->
```mermaid
gitGraph:
commit "Ashish"
branch newbranch
checkout newbranch
commit id:"1111"
commit tag:"test"
checkout main
commit type: HIGHLIGHT
commit
merge newbranch
commit
branch b2
commit
```
```mermaid
stateDiagram
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
```
```mermaid
sankey-beta
Pumped heat,"Heating and cooling, ""homes""",193.026
Pumped heat,"Heating and cooling, ""commercial""",70.672
```
```mermaid
sequenceDiagram
loop Daily query
Alice->>Bob: Hello Bob, how are you?
alt is sick
Bob->>Alice: Not so good :(
else is well
Bob->>Alice: Feeling fresh like a daisy
end
opt Extra response
Bob->>Alice: Thanks for asking
end
end
```
```mermaid
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
```
## GoAT
```goat
. . . .--- 1 .-- 1 / 1
/ \ | | .---+ .-+ +
/ \ .---+---. .--+--. | '--- 2 | '-- 2 / \ 2
+ + | | | | ---+ ---+ +
/ \ / \ .-+-. .-+-. .+. .+. | .--- 3 | .-- 3 \ / 3
/ \ / \ | | | | | | | | '---+ '-+ +
1 2 3 4 1 2 3 4 1 2 3 4 '--- 4 '-- 4 \ 4
```

View File

@ -3,11 +3,13 @@ languageCode = "en-us"
defaultContentLanguage = "en" defaultContentLanguage = "en"
title = "Anubis2 Demo Site" title = "Anubis2 Demo Site"
theme = "anubis2" theme = "anubis2"
paginate = 5
disqusShortname = "" disqusShortname = ""
[author] [pagination]
pagerSize = 5
[params.author]
name = "Junyi" name = "Junyi"
email = "me@junyi.dev" email = "me@junyi.dev"
location = "Singapore" location = "Singapore"

View File

@ -12,9 +12,27 @@
<link>{{ .RelPermalink }}</link> <link>{{ .RelPermalink }}</link>
<description>{{ .Site.Title }}{{ if ne .Title .Site.Title }}{{ with .Title }} ({{.}}){{ end }}{{ end }}</description> <description>{{ .Site.Title }}{{ if ne .Title .Site.Title }}{{ with .Title }} ({{.}}){{ end }}{{ end }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }} <language>{{.}}</language>{{end}}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} {{ with .Site.Params.author }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} {{ with .email }}
<managingEditor>{{.}}
{{ with $.Site.Params.author.name }}
({{.}})
{{end}}
</managingEditor>
{{end}}
{{ with .Site.Params.author.email }}
<webMaster>
{{.}}
{{ with $.Site.Params.author.name }}
({{.}})
{{end}}
</webMaster>
{{end}}
{{ end }}
{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" }} {{ with .OutputFormats.Get "RSS" }}
@ -25,7 +43,7 @@
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .RelPermalink }}</link> <link>{{ .RelPermalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} {{ with .Site.Params.author.email }}<author>{{.}}{{ with $.Site.Params.author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .RelPermalink }}</guid> <guid>{{ .RelPermalink }}</guid>
<description>{{ .Content | html }}</description> <description>{{ .Content | html }}</description>
</item> </item>

View File

@ -23,8 +23,8 @@
</article> </article>
{{ $readNextPosts := 3}} {{ $readNextPosts := 3}}
{{ if isset .Site.Params "readnextposts" }} {{ if site.Params.readNextPosts }}
{{ $readNextPosts = .Site.Params.readNextPosts }} {{ $readNextPosts = site.Params.readNextPosts }}
{{ end }} {{ end }}
{{ if gt $readNextPosts 0 }} {{ if gt $readNextPosts 0 }}
@ -56,7 +56,7 @@
{{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/load-mermaid.js") }} {{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/load-mermaid.js") }}
{{ $colorTheme := "light" }} {{ $colorTheme := "light" }}
{{ if and (isset site.Params "colortheme") (ne site.Params.colortheme "") }} {{ if and (site.Params.colortheme) (ne site.Params.colortheme "") }}
{{ $colorTheme = site.Params.colortheme | lower }} {{ $colorTheme = site.Params.colortheme | lower }}
{{ end }} {{ end }}

View File

@ -1,4 +1,4 @@
{{ if .Site.DisqusShortname }} {{ if .Site.Config.Services.Disqus.Shortname }}
{{ partial "disqus.html" . }} {{ partial "disqus.html" . }}
{{ end }} {{ end }}

View File

@ -5,23 +5,23 @@
{{ end }} {{ end }}
<div class="common-footer-bottom"> <div class="common-footer-bottom">
{{ if .Site.Menus.footer }} {{ if site.Menus.footer }}
{{ $currentPage := . }} {{ $currentPage := . }}
<ul class="footer-menu"> <ul class="footer-menu">
{{ range .Site.Menus.footer }} {{ range site.Menus.footer }}
<li><a class="{{if or ($currentPage.IsMenuCurrent "footer" .) ($currentPage.HasMenuCurrent "footer" .) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a></li> <li><a class="{{if or ($currentPage.IsMenuCurrent "footer" .) ($currentPage.HasMenuCurrent "footer" .) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a></li>
{{ end }} {{ end }}
</ul> </ul>
{{ end }} {{ end }}
<div style="display: flex; align-items: center; gap:8px"> <div style="display: flex; align-items: center; gap:8px">
© {{ if isset .Site.Author "name"}}{{ .Site.Author.name }}, {{end}}{{ now.Year }} © {{ if site.Params.Author.name }} {{ site.Params.Author.name }}, {{end}} {{ now.Year }}
{{ if .Site.Params.UmamiAnalytics.shareUrl }} {{ if site.Params.UmamiAnalytics.shareUrl }}
<a aria-label="Check statistics data" style="display: flex; align-items: center; border-bottom: none; cursor: pointer; color: var(--pagination-link-color)" href="{{ .Site.Params.UmamiAnalytics.shareUrl }}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-report-analytics"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2" /><path d="M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z" /><path d="M9 17v-5" /><path d="M12 17v-1" /><path d="M15 17v-3" /></svg></a> <a aria-label="Check statistics data" style="display: flex; align-items: center; border-bottom: none; cursor: pointer; color: var(--pagination-link-color)" href="{{ site.Params.UmamiAnalytics.shareUrl }}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-report-analytics"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2" /><path d="M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z" /><path d="M9 17v-5" /><path d="M12 17v-1" /><path d="M15 17v-3" /></svg></a>
{{ end }} {{ end }}
</div> </div>
<div style="display:flex;align-items: center"> <div style="display:flex;align-items: center">
{{ $police := .Site.Params.police }} {{ $police := site.Params.police }}
{{ $info := "info" }} {{ $info := "info" }}
{{ $pattern := "[0-9]+" }} {{ $pattern := "[0-9]+" }}
{{ $matches := findRE $pattern $police }} {{ $matches := findRE $pattern $police }}
@ -29,11 +29,11 @@
{{ $firstNumber := index $matches 0 }} {{ $firstNumber := index $matches 0 }}
{{ $info = print $firstNumber }} {{ $info = print $firstNumber }}
<img src="https://beian.mps.gov.cn/img/logo01.dd7ff50e.png" alt="备案图标" style="width: 1em;height: 1em;object-fit: contain;"> <img src="https://beian.mps.gov.cn/img/logo01.dd7ff50e.png" alt="备案图标" style="width: 1em;height: 1em;object-fit: contain;">
<a target="_blank" href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode={{$info}}">{{ .Site.Params.police }}</a> <a target="_blank" href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode={{$info}}">{{ site.Params.police }}</a>
&nbsp; &nbsp;
{{ end }} {{ end }}
{{ if .Site.Params.icp }} {{ if site.Params.icp }}
<a target="_blank" href="https://beian.miit.gov.cn/">{{ .Site.Params.icp }}</a> <a target="_blank" href="https://beian.miit.gov.cn/">{{ site.Params.icp }}</a>
{{ end }} {{ end }}
</div> </div>
<div> <div>

View File

@ -1,7 +1,24 @@
<article class="post-list h-feed post-card"> <article class="post-list h-feed post-card">
<div class="post-header"> <div class="post-header">
<header> <header>
<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " | markdownify }}</a></h1> {{ $random := (md5 .Title) }}
{{ $iconPath := printf "%sicon.svg" .File.Dir }}
{{ if fileExists $iconPath }}
<style>
.post-icon-{{ $random }}::before {
display: inline-block;
content: '';
background: url("/{{ $iconPath }}");
width: 1.2em;
height: 1.2em;
background-size: auto 100%;
vertical-align: text-bottom;
}
</style>
{{ end }}
<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}} {{ if fileExists $iconPath}}post-icon-{{$random}}{{end}}">
<a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " | markdownify }}</a>
</h1>
</header> </header>
{{ partial "post-language-switcher.html" . }} {{ partial "post-language-switcher.html" . }}
</div> </div>
@ -11,6 +28,7 @@
{{ .Summary | safeHTML }} {{ .Summary | safeHTML }}
</div> </div>
{{ end }} {{ end }}
{{ if and (.Truncated) (.Site.Params.readMore) }} {{ if and (.Truncated) (.Site.Params.readMore) }}
<div class="read-more"> <div class="read-more">
<a class="u-url" href="{{ .RelPermalink }}">{{ i18n "readMore" }}</a> <a class="u-url" href="{{ .RelPermalink }}">{{ i18n "readMore" }}</a>