docs: improve version used for docs (#188)

This commit is contained in:
Dillon 2020-03-19 16:54:47 +08:00 committed by GitHub
parent 774e831a21
commit a9850f7df3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 82 additions and 47 deletions

View file

@ -331,8 +331,16 @@
}
.version {
font-weight: bold;
font-style: normal;
img {
min-height: 1.2rem;
vertical-align: sub;
}
&.small {
img {
min-height: 1rem;
}
}
}
}

View file

@ -42,7 +42,7 @@ Since [Markdown Render Hooks](https://gohugo.io/getting-started/configuration-ma
{{< /admonition >}}
{{< admonition note "Why need the Hugo extended version?" >}}
Since this theme processes SCSS to CSS, Hugo needs to be the extended version.
Since this theme processes SCSS to CSS, Hugo needs to be the **extended** version.
{{< /admonition >}}
## 2 Installation
@ -193,8 +193,8 @@ Note that some of these parameters are explained in details in other sections of
defaultTheme = "auto"
# public git repo url only then enableGitInfo is true
gitRepo = ""
# {{< version 0.1.1 >}}
# which hash function used for SRI, when empty, no SRI is used ("sha256", "sha384", "sha512", "md5")
# {{< version 0.1.1 new small >}} which hash function used for SRI, when empty, no SRI is used
# ("sha256", "sha384", "sha512", "md5")
fingerprint = ""
# Header info
[params.header]
@ -225,8 +225,7 @@ Note that some of these parameters are explained in details in other sections of
typeit = true
# whether to show social links
social = true
# {{< version 0.2.0 >}}
# disclaimer (HTML format is supported)
# {{< version 0.2.0 new small >}} disclaimer (HTML format is supported)
disclaimer = ""
# Home Page Posts
[params.home.posts]
@ -356,13 +355,13 @@ Note that some of these parameters are explained in details in other sections of
enable = true
# {{< link "https://disqus.com/" Disqus >}} Comment Config
[params.comment.disqus]
# {{< version 0.1.1 >}}
# {{< version 0.1.1 new small >}}
enable = false
# Disqus shortname to use Disqus in posts
shortname = ""
# {{< link "https://github.com/gitalk/gitalk" Gitalk >}} Comment Config
[params.comment.gitalk]
# {{< version 0.1.1 >}}
# {{< version 0.1.1 new small >}}
enable = false
owner = ""
repo = ""
@ -389,8 +388,7 @@ Note that some of these parameters are explained in details in other sections of
numPosts = 10
appId = ""
languageCode = "en_US"
# {{< version 0.2.0 >}}
# {{< link "https://comments.app/" "Telegram Comments" >}} Config
# {{< version 0.2.0 new small >}} {{< link "https://comments.app/" "Telegram Comments" >}} Config
[params.comment.telegram]
enable = false
siteID = ""

View file

@ -47,7 +47,7 @@ Since [Markdown Render Hooks](https://gohugo.io/getting-started/configuration-ma
{{< /admonition >}}
{{< admonition note "Why need the Hugo extended version?" >}}
Since this theme processes SCSS to CSS, Hugo needs to be the extended version.
Since this theme processes SCSS to CSS, Hugo needs to be the **extended** version.
{{< /admonition >}}
## 2 Installation
@ -198,8 +198,8 @@ Note that some of these parameters are explained in details in other sections of
defaultTheme = "auto"
# public git repo url only then enableGitInfo is true
gitRepo = ""
# {{< version 0.1.1 >}}
# which hash function used for SRI, when empty, no SRI is used ("sha256", "sha384", "sha512", "md5")
# {{< version 0.1.1 new small >}} which hash function used for SRI, when empty, no SRI is used
# ("sha256", "sha384", "sha512", "md5")
fingerprint = ""
# Header info
[params.header]
@ -230,8 +230,7 @@ Note that some of these parameters are explained in details in other sections of
typeit = true
# whether to show social links
social = true
# {{< version 0.2.0 >}}
# disclaimer (HTML format is supported)
# {{< version 0.2.0 new small >}} disclaimer (HTML format is supported)
disclaimer = ""
# Home Page Posts
[params.home.posts]
@ -361,13 +360,13 @@ Note that some of these parameters are explained in details in other sections of
enable = true
# {{< link "https://disqus.com/" Disqus >}} Comment Config
[params.comment.disqus]
# {{< version 0.1.1 >}}
# {{< version 0.1.1 new small >}}
enable = false
# Disqus shortname to use Disqus in posts
shortname = ""
# {{< link "https://github.com/gitalk/gitalk" Gitalk >}} Comment Config
[params.comment.gitalk]
# {{< version 0.1.1 >}}
# {{< version 0.1.1 new small >}}
enable = false
owner = ""
repo = ""
@ -394,8 +393,7 @@ Note that some of these parameters are explained in details in other sections of
numPosts = 10
appId = ""
languageCode = "en_US"
# {{< version 0.2.0 >}}
# {{< link "https://comments.app/" "Telegram Comments" >}} Config
# {{< version 0.2.0 new small >}} {{< link "https://comments.app/" "Telegram Comments" >}} Config
[params.comment.telegram]
enable = false
siteID = ""

View file

@ -42,7 +42,7 @@ comment: true
{{< /admonition >}}
{{< admonition note "为什么需要 Hugo extended 版本?" >}}
由于本主题需要转换 SCSS 文件为 CSS 文件, Hugo extended 版本是必要的.
由于本主题需要转换 SCSS 文件为 CSS 文件, Hugo **extended** 版本是必要的.
{{< /admonition >}}
## 2 安装
@ -196,8 +196,8 @@ hugo
defaultTheme = "auto"
# 公共 git 仓库路径,仅在 enableGitInfo 设为 true 时有效
gitRepo = ""
# {{< version 0.1.1 >}}
# 哪种哈希函数用来 SRI, 为空时表示不使用 SRI ("sha256", "sha384", "sha512", "md5")
# {{< version 0.1.1 new small >}} 哪种哈希函数用来 SRI, 为空时表示不使用 SRI
# ("sha256", "sha384", "sha512", "md5")
fingerprint = ""
# 页面头部导航栏信息
[params.header]
@ -228,8 +228,7 @@ hugo
typeit = true
# 是否显示社交账号
social = true
# {{< version 0.2.0 >}}
# 免责声明 (支持 HTML 格式)
# {{< version 0.2.0 new small >}} 免责声明 (支持 HTML 格式)
disclaimer = ""
# 主页文章列表
[params.home.posts]
@ -358,13 +357,13 @@ hugo
enable = true
# {{< link "https://disqus.com/" Disqus >}} 评论系统设置
[params.comment.disqus]
# {{< version 0.1.1 >}}
# {{< version 0.1.1 new small >}}
enable = false
# Disqus 的 shortname用来在文章中启用 Disqus 评论系统
shortname = ""
# {{< link "https://github.com/gitalk/gitalk" Gitalk >}} 评论系统设置
[params.comment.gitalk]
# {{< version 0.1.1 >}}
# {{< version 0.1.1 new small >}}
enable = false
owner = ""
repo = ""
@ -391,8 +390,7 @@ hugo
numPosts = 10
appId = ""
languageCode = "zh_CN"
# {{< version 0.2.0 >}}
# {{< link "https://comments.app/" "Telegram Comments" >}} 评论系统设置
# {{< version 0.2.0 new small >}} {{< link "https://comments.app/" "Telegram Comments" >}} 评论系统设置
[params.comment.telegram]
enable = false
siteID = ""

View file

@ -76,7 +76,7 @@ comment: true
```
* **title**: the title for the content.
* **subtitle**: the subtitle for the content. {{< version 0.2.0 >}}
* **subtitle**: {{< version 0.2.0 >}} the subtitle for the content.
* **date**: the datetime assigned to this page, which is usually fetched from the `date` field in front matter, but this behaviour is configurabl in the [site configuration](../theme-documentation-basics/#site-configuration).
* **lastmod**: the datetime at which the content was last modified.
* **draft**: if `true`, the content will not be rendered unless the `--buildDrafts`/`-D` flag is passed to the `hugo` command.
@ -243,9 +243,7 @@ The rendered output looks like this:
### Fraction
{{< admonition warning >}}
{{< version 0.2.0 >}}
{{< /admonition >}}
An extended Markdown syntax for **fraction** is supported in **LoveIt** theme:

View file

@ -81,7 +81,7 @@ comment: true
```
* **title**: the title for the content.
* **subtitle**: the subtitle for the content. **{{< version 0.2.0 >}}**
* **subtitle**: {{< version 0.2.0 >}} the subtitle for the content.
* **date**: the datetime assigned to this page, which is usually fetched from the `date` field in front matter, but this behaviour is configurabl in the [site configuration](../theme-documentation-basics/#site-configuration).
* **lastmod**: the datetime at which the content was last modified.
* **draft**: if `true`, the content will not be rendered unless the `--buildDrafts`/`-D` flag is passed to the `hugo` command.
@ -248,9 +248,7 @@ The rendered output looks like this:
### Fraction
{{< admonition warning >}}
{{< version 0.2.0 >}}
{{< /admonition >}}
An extended Markdown syntax for **fraction** is supported in **LoveIt** theme:

View file

@ -76,7 +76,7 @@ comment: true
```
* **title**: 文章标题.
* **subtitle**: 文章副标题. **{{< version 0.2.0 >}}**
* **subtitle**: {{< version 0.2.0 >}} 文章副标题.
* **date**: 这篇文章创建的日期时间. 它通常是从文章的前置参数中的 `date` 字段获取的, 但是也可以在 [网站配置](../theme-documentation-basics/#site-configuration) 中设置.
* **lastmod**: 上次修改内容的日期时间.
* **draft**: 如果设为 `true`, 除非 `hugo` 命令使用了 `--buildDrafts`/`-D` 参数, 这篇文章不会被渲染.
@ -243,9 +243,7 @@ $$ \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} $$
### 分数
{{< admonition warning >}}
{{< version 0.2.0 >}}
{{< /admonition >}}
**LoveIt** 主题支持一种 **分数** Markdown 扩展语法:

View file

@ -223,9 +223,7 @@ This is a right-aligned paragraph.
### `link`
{{< admonition warning >}}
{{< version 0.2.0 >}}
{{< /admonition >}}
`link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax/#links). `link` shortcode can provide some other features and can be used in code blocks.
@ -289,6 +287,8 @@ The rendered output looks like this (hover over the link, there should be a tool
### `image`
{{< version 0.2.0 changed >}}
`image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js).
The `image` shortcode has the following named parameters:

View file

@ -228,9 +228,7 @@ This is a right-aligned paragraph.
### `link`
{{< admonition warning >}}
{{< version 0.2.0 >}}
{{< /admonition >}}
`link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax/#links). `link` shortcode can provide some other features and can be used in code blocks.
@ -294,6 +292,8 @@ The rendered output looks like this (hover over the link, there should be a tool
### `image`
{{< version 0.2.0 changed >}}
`image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js).
The `image` shortcode has the following named parameters:

View file

@ -224,9 +224,7 @@ This is a right-aligned paragraph.
### `link`
{{< admonition warning >}}
{{< version 2.2.0 >}}
{{< /admonition >}}
{{< version 0.2.0 >}}
`link` shortcode 是 [Markdown 链接语法](../basic-markdown-syntax/#links) 的替代.
`link` shortcode 可以提供一些其它的功能并且可以在代码块中使用.
@ -291,6 +289,8 @@ This is a right-aligned paragraph.
### `image`
{{< version 0.2.0 changed >}}
`image` shortcode 是 [`figure` shortcode](#figure) 的替代. `image` shortcode 可以充分利用 [lazysizes](https://github.com/aFarkas/lazysizes) 和 [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js) 两个依赖库.
`image` shortcode 有以下命名参数:

View file

@ -146,3 +146,14 @@ other = "Example"
[quote]
other = "Quote"
# === shortcodes/admonition.html ===
# === shortcodes/version.html ===
[new]
other = "NEW"
[changed]
other = "CHANGED"
[deleted]
other = "DELETED"
# === shortcodes/version.html ===

View file

@ -146,3 +146,14 @@ other = "Exemple"
[quote]
other = "Citation"
# === shortcodes/admonition.html ===
# === shortcodes/version.html ===
[new]
other = "NOUVEAU"
[changed]
other = "CHANGE"
[deleted]
other = "EFFACE"
# === shortcodes/version.html ===

View file

@ -146,3 +146,14 @@ other = "示例"
[quote]
other = "引用"
# === shortcodes/admonition.html ===
# === shortcodes/version.html ===
[new]
other = "新增"
[changed]
other = "更改"
[deleted]
other = "删除"
# === shortcodes/version.html ===

View file

@ -1 +1,7 @@
<span class="version"><i class="far fa-heart fa-fw"></i> LoveIt <i class="fas fa-greater-than-equal fa-fw"></i> <a href="https://github.com/dillonzq/LoveIt/releases/tag/v{{ .Get 0 }}" rel="noopener noreffer" target="_blank" title="LoveIt v{{ .Get 0 }}">{{ .Get 0 }}</a></span>
{{- $version := .Get 0 -}}
{{- $url := printf "https://github.com/dillonzq/LoveIt/releases/tag/v%s" $version -}}
{{- $label := .Get 1 | default "new" | T -}}
{{- $color := cond (.Get 1 | eq "changed") "ff9101" "00b1ff" | cond (.Get 1 | eq "deleted") "ff5252" -}}
{{- $badge := printf "https://img.shields.io/badge/%s-%s-%s?style=flat-square&labelColor=403c3d&?cacheSeconds=maxAge" $label $version $color -}}
{{- $alt := printf "LoveIt %s | %s" $label $version -}}
<span class="version{{ if .Get 2 | eq `small` }} small{{ end }}"><a href="{{ $url }}" rel="noopener noreffer" target="_blank">{{ partial "plugin/image.html" (dict "src" $badge "alt" $alt) }}</a></span>