📝 Docs: split the document and reduce the length of a single post

This commit is contained in:
Cell
2022-07-20 12:43:52 +08:00
parent 982175b8db
commit 7ab30e5905
27 changed files with 1694 additions and 1459 deletions
+2 -2
View File
@@ -188,7 +188,7 @@ enableEmoji = true
[languages.en.params.home.posts]
enable = true
# special amount of posts in each home posts page
paginate = 5
paginate = 6
# Social config in home page
[languages.en.params.social]
GitHub = "xxxx"
@@ -422,7 +422,7 @@ enableEmoji = true
[languages.zh-cn.params.home.posts]
enable = true
# 主页每页显示文章数量
paginate = 5
paginate = 6
# 主页的社交信息设置
[languages.zh-cn.params.social]
GitHub = "xxxx"
Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

@@ -0,0 +1,58 @@
---
title: "Extended Shortcode - bilibili"
date: 2022-07-20T13:55:03+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "The bilibili shortcode embeds a responsive video player for bilibili videos."
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
---
{{< version 0.2.0 changed >}}
The `bilibili` shortcode embeds a responsive video player for bilibili videos.
<!--more-->
When the video only has one part, only the BV `id` of the video is required, e.g.:
```code
https://www.bilibili.com/video/BV1Sx411T7QQ
```
Example `bilibili` input:
```go-html-template
{{</* bilibili BV1Sx411T7QQ */>}}
Or
{{</* bilibili id=BV1Sx411T7QQ */>}}
```
The rendered output looks like this:
{{< bilibili id=BV1Sx411T7QQ >}}
When the video has multiple parts, in addition to the BV `id` of the video,
`p` is also required, whose default value is `1`, e.g.:
```code
https://www.bilibili.com/video/BV1TJ411C7An?p=3
```
Example `bilibili` input with `p`:
```go-html-template
{{</* bilibili BV1TJ411C7An 3 */>}}
Or
{{</* bilibili id=BV1TJ411C7An p=3 */>}}
```
The rendered output looks like this:
{{< bilibili id=BV1TJ411C7An p=3 >}}
@@ -0,0 +1,57 @@
---
title: "扩展 Shortcode - bilibili"
date: 2022-07-20T13:55:03+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "bilibili shortcode 提供了一个内嵌的用来播放 bilibili 视频的响应式播放器。"
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
---
{{< version 0.2.0 changed >}}
`bilibili` shortcode 提供了一个内嵌的用来播放 bilibili 视频的响应式播放器。
<!--more-->
如果视频只有一个部分,则仅需要视频的 BV `id`, 例如:
```code
https://www.bilibili.com/video/BV1Sx411T7QQ
```
一个 `bilibili` 示例:
```go-html-template
{{</* bilibili BV1Sx411T7QQ */>}}
或者
{{</* bilibili id=BV1Sx411T7QQ */>}}
```
呈现的输出效果如下:
{{< bilibili id=BV1Sx411T7QQ >}}
如果视频包含多个部分,则除了视频的 BV `id` 之外,还需要 `p`, 默认值为 `1`, 例如:
```code
https://www.bilibili.com/video/BV1TJ411C7An?p=3
```
一个带有 `p` 参数的 `bilibili` 示例:
```go-html-template
{{</* bilibili BV1TJ411C7An 3 */>}}
或者
{{</* bilibili id=BV1TJ411C7An p=3 */>}}
```
呈现的输出效果如下:
{{< bilibili id=BV1TJ411C7An p=3 >}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@@ -0,0 +1,407 @@
---
title: "Extended Shortcode - echarts"
date: 2022-07-20T11:44:15+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "The echarts shortcode supports data visualization in Hugo with ECharts library."
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
code:
maxShownLines: 70
---
The `echarts` shortcode supports data visualization in Hugo with [ECharts](https://echarts.apache.org/) library.
<!--more-->
**ECharts** is a library helping you to generate interactive data visualization.
The basic chart types ECharts supports include [line series](https://echarts.apache.org/en/option.html#series-line), [bar series](https://echarts.apache.org/en/option.html#series-line), [scatter series](https://echarts.apache.org/en/option.html#series-scatter), [pie charts](https://echarts.apache.org/en/option.html#series-pie), [candle-stick series](https://echarts.apache.org/en/option.html#series-candlestick), [boxplot series](https://echarts.apache.org/en/option.html#series-boxplot) for statistics, [map series](https://echarts.apache.org/en/option.html#series-map), [heatmap series](https://echarts.apache.org/en/option.html#series-heatmap), [lines series](https://echarts.apache.org/en/option.html#series-lines) for directional information, [graph series](https://echarts.apache.org/en/option.html#series-graph) for relationships, [treemap series](https://echarts.apache.org/en/option.html#series-treemap), [sunburst series](https://echarts.apache.org/en/option.html#series-sunburst), [parallel series](https://echarts.apache.org/en/option.html#series-parallel) for multi-dimensional data, [funnel series](https://echarts.apache.org/en/option.html#series-funnel), [gauge series](https://echarts.apache.org/en/option.html#series-gauge). And it's extremely easy to create a combinition of them with ECharts.
Just insert your ECharts option in `JSON`/`YAML`/`TOML` format in the `echarts` shortcode and thats it.
Example `echarts` input in `JSON` format:
```json
{{</* echarts */>}}
{
"title": {
"text": "Summary Line Chart",
"top": "2%",
"left": "center"
},
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["Email Marketing", "Affiliate Advertising", "Video Advertising", "Direct View", "Search Engine"],
"top": "10%"
},
"grid": {
"left": "5%",
"right": "5%",
"bottom": "5%",
"top": "20%",
"containLabel": true
},
"toolbox": {
"feature": {
"saveAsImage": {
"title": "Save as Image"
}
}
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
},
"yAxis": {
"type": "value"
},
"series": [
{
"name": "Email Marketing",
"type": "line",
"stack": "Total",
"data": [120, 132, 101, 134, 90, 230, 210]
},
{
"name": "Affiliate Advertising",
"type": "line",
"stack": "Total",
"data": [220, 182, 191, 234, 290, 330, 310]
},
{
"name": "Video Advertising",
"type": "line",
"stack": "Total",
"data": [150, 232, 201, 154, 190, 330, 410]
},
{
"name": "Direct View",
"type": "line",
"stack": "Total",
"data": [320, 332, 301, 334, 390, 330, 320]
},
{
"name": "Search Engine",
"type": "line",
"stack": "Total",
"data": [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
{{</* /echarts */>}}
```
The same in `YAML` format:
```yaml
{{</* echarts */>}}
title:
text: Summary Line Chart
top: 2%
left: center
tooltip:
trigger: axis
legend:
data:
- Email Marketing
- Affiliate Advertising
- Video Advertising
- Direct View
- Search Engine
top: 10%
grid:
left: 5%
right: 5%
bottom: 5%
top: 20%
containLabel: true
toolbox:
feature:
saveAsImage:
title: Save as Image
xAxis:
type: category
boundaryGap: false
data:
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Saturday
- Sunday
yAxis:
type: value
series:
- name: Email Marketing
type: line
stack: Total
data:
- 120
- 132
- 101
- 134
- 90
- 230
- 210
- name: Affiliate Advertising
type: line
stack: Total
data:
- 220
- 182
- 191
- 234
- 290
- 330
- 310
- name: Video Advertising
type: line
stack: Total
data:
- 150
- 232
- 201
- 154
- 190
- 330
- 410
- name: Direct View
type: line
stack: Total
data:
- 320
- 332
- 301
- 334
- 390
- 330
- 320
- name: Search Engine
type: line
stack: Total
data:
- 820
- 932
- 901
- 934
- 1290
- 1330
- 1320
{{</* /echarts */>}}
```
The same in `TOML` format:
```toml
{{</* echarts */>}}
[title]
text = "Summary Line Chart"
top = "2%"
left = "center"
[tooltip]
trigger = "axis"
[legend]
data = [
"Email Marketing",
"Affiliate Advertising",
"Video Advertising",
"Direct View",
"Search Engine"
]
top = "10%"
[grid]
left = "5%"
right = "5%"
bottom = "5%"
top = "20%"
containLabel = true
[toolbox]
[toolbox.feature]
[toolbox.feature.saveAsImage]
title = "Save as Image"
[xAxis]
type = "category"
boundaryGap = false
data = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
]
[yAxis]
type = "value"
[[series]]
name = "Email Marketing"
type = "line"
stack = "Total"
data = [
120.0,
132.0,
101.0,
134.0,
90.0,
230.0,
210.0
]
[[series]]
name = "Affiliate Advertising"
type = "line"
stack = "Total"
data = [
220.0,
182.0,
191.0,
234.0,
290.0,
330.0,
310.0
]
[[series]]
name = "Video Advertising"
type = "line"
stack = "Total"
data = [
150.0,
232.0,
201.0,
154.0,
190.0,
330.0,
410.0
]
[[series]]
name = "Direct View"
type = "line"
stack = "Total"
data = [
320.0,
332.0,
301.0,
334.0,
390.0,
330.0,
320.0
]
[[series]]
name = "Search Engine"
type = "line"
stack = "Total"
data = [
820.0,
932.0,
901.0,
934.0,
1290.0,
1330.0,
1320.0
]
{{</* /echarts */>}}
```
The rendered output looks like this:
{{< echarts >}}
{
"title": {
"text": "Summary Line Chart",
"top": "2%",
"left": "center"
},
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["Email Marketing", "Affiliate Advertising", "Video Advertising", "Direct View", "Search Engine"],
"top": "10%"
},
"grid": {
"left": "5%",
"right": "5%",
"bottom": "5%",
"top": "20%",
"containLabel": true
},
"toolbox": {
"feature": {
"saveAsImage": {
"title": "Save as Image"
}
}
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
},
"yAxis": {
"type": "value"
},
"series": [
{
"name": "Email Marketing",
"type": "line",
"stack": "Total",
"data": [120, 132, 101, 134, 90, 230, 210]
},
{
"name": "Affiliate Advertising",
"type": "line",
"stack": "Total",
"data": [220, 182, 191, 234, 290, 330, 310]
},
{
"name": "Video Advertising",
"type": "line",
"stack": "Total",
"data": [150, 232, 201, 154, 190, 330, 410]
},
{
"name": "Direct View",
"type": "line",
"stack": "Total",
"data": [320, 332, 301, 334, 390, 330, 320]
},
{
"name": "Search Engine",
"type": "line",
"stack": "Total",
"data": [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
{{< /echarts >}}
The `echarts` shortcode has also the following named parameters:
* **width** *[optional]* (**first** positional parameter)
{{< version 0.2.0 >}} Width of the data visualization, default value is `100%`.
* **height** *[optional]* (**second** positional parameter)
{{< version 0.2.0 >}} Height of the data visualization, default value is `30rem`.
@@ -0,0 +1,407 @@
---
title: "扩展 Shortcode - echarts"
date: 2022-07-20T11:44:15+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "echarts shortcode 使用 ECharts 库提供数据可视化的功能。"
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
code:
maxShownLines: 70
---
`echarts` shortcode 使用 [ECharts](https://echarts.apache.org/) 库提供数据可视化的功能.
<!--more-->
**ECharts** 是一个帮助你生成交互式数据可视化的库.
ECharts 提供了常规的 [折线图](https://echarts.apache.org/zh/option.html#series-line), [柱状图](https://echarts.apache.org/zh/option.html#series-line), [散点图](https://echarts.apache.org/zh/option.html#series-scatter), [饼图](https://echarts.apache.org/zh/option.html#series-pie), [K线图](https://echarts.apache.org/zh/option.html#series-candlestick), 用于统计的 [盒形图](https://echarts.apache.org/zh/option.html#series-boxplot), 用于地理数据可视化的 [地图](https://echarts.apache.org/zh/option.html#series-map), [热力图](https://echarts.apache.org/zh/option.html#series-heatmap), [线图](https://echarts.apache.org/zh/option.html#series-lines), 用于关系数据可视化的 [关系图](https://echarts.apache.org/zh/option.html#series-graph), [treemap](https://echarts.apache.org/zh/option.html#series-treemap), [旭日图](https://echarts.apache.org/zh/option.html#series-sunburst), 多维数据可视化的 [平行坐标](https://echarts.apache.org/zh/option.html#series-parallel), 还有用于 BI 的 [漏斗图](https://echarts.apache.org/zh/option.html#series-funnel), [仪表盘](https://echarts.apache.org/zh/option.html#series-gauge), 并且支持图与图之间的混搭.
只需在 `echarts` shortcode 中以 `JSON`/`YAML`/`TOML`格式插入 ECharts 选项即可.
一个 `JSON` 格式的 `echarts` 示例:
```json
{{</* echarts */>}}
{
"title": {
"text": "折线统计图",
"top": "2%",
"left": "center"
},
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["邮件营销", "联盟广告", "视频广告", "直接访问", "搜索引擎"],
"top": "10%"
},
"grid": {
"left": "5%",
"right": "5%",
"bottom": "5%",
"top": "20%",
"containLabel": true
},
"toolbox": {
"feature": {
"saveAsImage": {
"title": "保存为图片"
}
}
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
},
"yAxis": {
"type": "value"
},
"series": [
{
"name": "邮件营销",
"type": "line",
"stack": "总量",
"data": [120, 132, 101, 134, 90, 230, 210]
},
{
"name": "联盟广告",
"type": "line",
"stack": "总量",
"data": [220, 182, 191, 234, 290, 330, 310]
},
{
"name": "视频广告",
"type": "line",
"stack": "总量",
"data": [150, 232, 201, 154, 190, 330, 410]
},
{
"name": "直接访问",
"type": "line",
"stack": "总量",
"data": [320, 332, 301, 334, 390, 330, 320]
},
{
"name": "搜索引擎",
"type": "line",
"stack": "总量",
"data": [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
{{</* /echarts */>}}
```
一个 `YAML` 格式的 `echarts` 示例:
```yaml
{{</* echarts */>}}
title:
text: 折线统计图
top: 2%
left: center
tooltip:
trigger: axis
legend:
data:
- 邮件营销
- 联盟广告
- 视频广告
- 直接访问
- 搜索引擎
top: 10%
grid:
left: 5%
right: 5%
bottom: 5%
top: 20%
containLabel: true
toolbox:
feature:
saveAsImage:
title: 保存为图片
xAxis:
type: category
boundaryGap: false
data:
- 周一
- 周二
- 周三
- 周四
- 周五
- 周六
- 周日
yAxis:
type: value
series:
- name: 邮件营销
type: line
stack: 总量
data:
- 120
- 132
- 101
- 134
- 90
- 230
- 210
- name: 联盟广告
type: line
stack: 总量
data:
- 220
- 182
- 191
- 234
- 290
- 330
- 310
- name: 视频广告
type: line
stack: 总量
data:
- 150
- 232
- 201
- 154
- 190
- 330
- 410
- name: 直接访问
type: line
stack: 总量
data:
- 320
- 332
- 301
- 334
- 390
- 330
- 320
- name: 搜索引擎
type: line
stack: 总量
data:
- 820
- 932
- 901
- 934
- 1290
- 1330
- 1320
{{</* /echarts */>}}
```
一个 `TOML` 格式的 `echarts` 示例:
```toml
{{</* echarts */>}}
[title]
text = "折线统计图"
top = "2%"
left = "center"
[tooltip]
trigger = "axis"
[legend]
data = [
"邮件营销",
"联盟广告",
"视频广告",
"直接访问",
"搜索引擎"
]
top = "10%"
[grid]
left = "5%"
right = "5%"
bottom = "5%"
top = "20%"
containLabel = true
[toolbox]
[toolbox.feature]
[toolbox.feature.saveAsImage]
title = "保存为图片"
[xAxis]
type = "category"
boundaryGap = false
data = [
"周一",
"周二",
"周三",
"周四",
"周五",
"周六",
"周日"
]
[yAxis]
type = "value"
[[series]]
name = "邮件营销"
type = "line"
stack = "总量"
data = [
120.0,
132.0,
101.0,
134.0,
90.0,
230.0,
210.0
]
[[series]]
name = "联盟广告"
type = "line"
stack = "总量"
data = [
220.0,
182.0,
191.0,
234.0,
290.0,
330.0,
310.0
]
[[series]]
name = "视频广告"
type = "line"
stack = "总量"
data = [
150.0,
232.0,
201.0,
154.0,
190.0,
330.0,
410.0
]
[[series]]
name = "直接访问"
type = "line"
stack = "总量"
data = [
320.0,
332.0,
301.0,
334.0,
390.0,
330.0,
320.0
]
[[series]]
name = "搜索引擎"
type = "line"
stack = "总量"
data = [
820.0,
932.0,
901.0,
934.0,
1290.0,
1330.0,
1320.0
]
{{</* /echarts */>}}
```
呈现的输出效果如下:
{{< echarts >}}
{
"title": {
"text": "折线统计图",
"top": "2%",
"left": "center"
},
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["邮件营销", "联盟广告", "视频广告", "直接访问", "搜索引擎"],
"top": "10%"
},
"grid": {
"left": "5%",
"right": "5%",
"bottom": "5%",
"top": "20%",
"containLabel": true
},
"toolbox": {
"feature": {
"saveAsImage": {
"title": "保存为图片"
}
}
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
},
"yAxis": {
"type": "value"
},
"series": [
{
"name": "邮件营销",
"type": "line",
"stack": "总量",
"data": [120, 132, 101, 134, 90, 230, 210]
},
{
"name": "联盟广告",
"type": "line",
"stack": "总量",
"data": [220, 182, 191, 234, 290, 330, 310]
},
{
"name": "视频广告",
"type": "line",
"stack": "总量",
"data": [150, 232, 201, 154, 190, 330, 410]
},
{
"name": "直接访问",
"type": "line",
"stack": "总量",
"data": [320, 332, 301, 334, 390, 330, 320]
},
{
"name": "搜索引擎",
"type": "line",
"stack": "总量",
"data": [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
{{< /echarts >}}
`echarts` shortcode 还有以下命名参数:
* **width** *[可选]* (**第一个**位置参数)
{{< version 0.2.0 >}} 数据可视化的宽度, 默认值是 `100%`.
* **height** *[可选]* (**第二个**位置参数)
{{< version 0.2.0 >}} 数据可视化的高度, 默认值是 `30rem`.
Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

@@ -0,0 +1,97 @@
---
title: "Extended Shortcode - mapbox"
date: 2022-07-20T12:22:15+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "The mapbox shortcode supports interactive maps in Hugo with Mapbox GL JS library."
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
---
{{< version 0.2.0 >}}
The `mapbox` shortcode supports interactive maps in Hugo with [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) library.
<!--more-->
[Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) is a JavaScript library that uses WebGL to render interactive maps from [vector tiles](https://docs.mapbox.com/help/glossary/vector-tiles/) and [Mapbox styles](https://docs.mapbox.com/mapbox-gl-js/style-spec/).
The `mapbox` shortcode has the following named parameters to use Mapbox GL JS:
* **lng** *[required]* (**first** positional parameter)
Longitude of the inital centerpoint of the map, measured in degrees.
* **lat** *[required]* (**second** positional parameter)
Latitude of the inital centerpoint of the map, measured in degrees.
* **zoom** *[optional]* (**third** positional parameter)
The initial zoom level of the map, default value is `10`.
* **marked** *[optional]* (**fourth** positional parameter)
Whether to add a marker at the inital centerpoint of the map, default value is `true`.
* **light-style** *[optional]* (**fifth** positional parameter)
Style for the light theme, default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **dark-style** *[optional]* (**sixth** positional parameter)
Style for the dark theme, default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **navigation** *[optional]*
Whether to add [NavigationControl](https://docs.mapbox.com/mapbox-gl-js/api#navigationcontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **geolocate** *[optional]*
Whether to add [GeolocateControl](https://docs.mapbox.com/mapbox-gl-js/api#geolocatecontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **scale** *[optional]*
Whether to add [ScaleControl](https://docs.mapbox.com/mapbox-gl-js/api#scalecontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **fullscreen** *[optional]*
Whether to add [FullscreenControl](https://docs.mapbox.com/mapbox-gl-js/api#fullscreencontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **width** *[optional]*
Width of the map, default value is `100%`.
* **height** *[optional]*
Height of the map, default value is `20rem`.
Example simple `mapbox` input:
```go-html-template
{{</* mapbox 113.953277 22.559102 11 */>}}
Or
{{</* mapbox lng=113.953277 lat=22.559102 zoom=11 */>}}
```
The rendered output looks like this:
{{< mapbox 113.953277 22.559102 11 >}}
Example `mapbox` input with the custom style:
```go-html-template
{{</* mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/navigation-preview-day-v4" "mapbox://styles/mapbox/navigation-preview-night-v4" */>}}
Or
{{</* mapbox lng=-122.252 lat=37.453 zoom=10 marked=false light-style="mapbox://styles/mapbox/navigation-preview-day-v4" dark-style="mapbox://styles/mapbox/navigation-preview-night-v4" */>}}
```
The rendered output looks like this:
{{< mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/navigation-preview-day-v4?optimize=true" "mapbox://styles/mapbox/navigation-preview-night-v4?optimize=true" >}}
@@ -0,0 +1,101 @@
---
title: "扩展 Shortcode - mapbox"
date: 2022-07-20T12:22:15+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "mapbox shortcode 使用 Mapbox GL JS 库提供互动式地图的功能。"
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
mapbox:
lightStyle: mapbox://styles/mapbox/light-zh-v1?optimize=true
darkStyle: mapbox://styles/mapbox/dark-zh-v1?optimize=true
---
{{< version 0.2.0 >}}
`mapbox` shortcode 使用 [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) 库提供互动式地图的功能.
<!--more-->
[Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) 是一个 JavaScript 库,它使用 WebGL, 以 [vector tiles](https://docs.mapbox.com/help/glossary/vector-tiles/) 和 [Mapbox styles](https://docs.mapbox.com/mapbox-gl-js/style-spec/) 为来源,将它们渲染成互动式地图。
`mapbox` shortcode 有以下命名参数来使用 Mapbox GL JS:
* **lng** *[必需]***第一个**位置参数)
地图初始中心点的经度,以度为单位。
* **lat** *[必需]***第二个**位置参数)
地图初始中心点的纬度,以度为单位。
* **zoom** *[可选]***第三个**位置参数)
地图的初始缩放级别,默认值是 `10`
* **marked** *[可选]***第四个**位置参数)
是否在地图的初始中心点添加图钉,默认值是 `true`
* **light-style** *[可选]***第五个**位置参数)
浅色主题的地图样式,默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **dark-style** *[可选]***第六个**位置参数)
深色主题的地图样式,默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **navigation** *[可选]*
是否添加 [NavigationControl](https://docs.mapbox.com/mapbox-gl-js/api#navigationcontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **geolocate** *[可选]*
是否添加 [GeolocateControl](https://docs.mapbox.com/mapbox-gl-js/api#geolocatecontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **scale** *[可选]*
是否添加 [ScaleControl](https://docs.mapbox.com/mapbox-gl-js/api#scalecontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **fullscreen** *[可选]*
是否添加 [FullscreenControl](https://docs.mapbox.com/mapbox-gl-js/api#fullscreencontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **width** *[可选]*
地图的宽度,默认值是 `100%`
* **height** *[可选]*
地图的高度,默认值是 `20rem`
一个简单的 `mapbox` 示例:
```go-html-template
{{</* mapbox 113.953277 22.559102 11 */>}}
或者
{{</* mapbox lng=113.953277 lat=22.559102 zoom=11 */>}}
```
呈现的输出效果如下:
{{< mapbox 113.953277 22.559102 11 >}}
一个带有自定义样式的 `mapbox` 示例:
```go-html-template
{{</* mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/streets-zh-v1" */>}}
或者
{{</* mapbox lng=-122.252 lat=37.453 zoom=10 marked=false light-style="mapbox://styles/mapbox/streets-zh-v1" */>}}
```
呈现的输出效果如下:
{{< mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/streets-zh-v1?optimize=true" >}}
@@ -1,7 +1,6 @@
---
title: "Extended Shortcode - mermaid"
date: 2022-07-09T17:20:15+08:00
draft: false
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "The mermaid shortcode supports diagrams in Hugo with Mermaid library."
@@ -1,10 +1,9 @@
---
title: "扩展 Shortcode - mermaid"
date: 2022-07-09T17:20:15+08:00
draft: false
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "mermaid shortcode 使用 Mermaid 库提供绘制图表和流程图的功能."
description: "mermaid shortcode 使用 Mermaid 库提供绘制图表和流程图的功能"
resources:
- name: "featured-image"
src: "featured-image.png"
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@@ -0,0 +1,156 @@
---
title: "Extended Shortcode - music"
date: 2022-07-20T13:01:03+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "The music shortcode embeds a responsive music player based on APlayer and MetingJS library."
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
---
The `music` shortcode embeds a responsive music player based on [APlayer](https://github.com/MoePlayer/APlayer) and [MetingJS](https://github.com/metowolf/MetingJS).
<!--more-->
There are three ways to use it the `music` shortcode.
## 1 Custom Music URL {#custom-music-url}
{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported.
The `music` shortcode has the following named parameters by custom music URL:
* **server** *[required]*
URL of the custom music.
* **name** *[optional]*
Name of the custom music.
* **artist** *[optional]*
Artist of the custom music.
* **cover** *[required]*
URL of the custom music cover.
Example `music` input by custom music URL:
```go-html-template
{{</* music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" */>}}
```
The rendered output looks like this:
{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}}
## 2 Music Platform URL Automatic Identification {#automatic-identification}
The `music` shortcode has one named parameter by music platform URL automatic identification:
* **auto** *[required]* (**first** positional parameter)
URL of the music platform URL for automatic identification,
which supports `netease`, `tencent` and `xiami` music platform.
Example `music` input by music platform URL automatic identification:
```go-html-template
{{</* music auto="https://music.163.com/#/playlist?id=60198" */>}}
Or
{{</* music "https://music.163.com/#/playlist?id=60198" */>}}
```
The rendered output looks like this:
{{< music auto="https://music.163.com/#/playlist?id=60198" >}}
## 3 Custom Server, Type and ID {#custom-server}
The `music` shortcode has the following named parameters by custom music platform:
* **server** *[required]* (**first** positional parameter)
[`netease`, `tencent`, `kugou`, `xiami`, `baidu`]
Music platform.
* **type** *[required]* (**second** positional parameter)
[`song`, `playlist`, `album`, `search`, `artist`]
Type of the music.
* **id** *[required]* (**third** positional parameter)
Song ID, or playlist ID, or album ID, or search keyword, or artist ID.
Example `music` input by custom music platform:
```go-html-template
{{</* music server="netease" type="song" id="1868553" */>}}
Or
{{</* music netease song 1868553 */>}}
```
The rendered output looks like this:
{{< music netease song 1868553 >}}
## 4 Other Parameters {#other-parameters}
The `music` shortcode has other named parameters applying to the above three ways:
* **theme** *[optional]*
{{< version 0.2.0 changed >}} Main color of the music player, default value is `#448aff`.
* **fixed** *[optional]*
Whether to enable fixed mode, default value is `false`.
* **mini** *[optional]*
Whether to enable mini mode, default value is `false`.
* **autoplay** *[optional]*
Whether to autoplay music, default value is `false`.
* **volume** *[optional]*
Default volume when the player is first opened, which will be remembered in the browser, default value is `0.7`.
* **mutex** *[optional]*
Whether to pause other players when this player starts playing, default value is `true`.
The `music` shortcode has the following named parameters only applying to the type of music list:
* **loop** *[optional]*
[`all`, `one`, `none`]
Loop mode of the music list, default value is `none`.
* **order** *[optional]*
[`list`, `random`]
Play order of the music list, default value is `list`.
* **list-folded** *[optional]*
Whether the music list should be folded at first, default value is `false`.
* **list-max-height** *[optional]*
Max height of the music list, default value is `340px`.
@@ -0,0 +1,155 @@
---
title: "扩展 Shortcode - music"
date: 2022-07-20T13:01:03+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "music shortcode 基于 APlayer 和 MetingJS 库提供了一个内嵌的响应式音乐播放器。"
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
---
`music` shortcode 基于 [APlayer](https://github.com/MoePlayer/APlayer) 和 [MetingJS](https://github.com/metowolf/MetingJS) 提供了一个内嵌的响应式音乐播放器。
<!--more-->
有三种方式使用 `music` shortcode。
## 1 自定义音乐 URL {#custom-music-url}
{{< version 0.2.10 >}} 支持 [本地资源引用](../theme-documentation-content#contents-organization) 的完整用法。
`music` shortcode 有以下命名参数来使用自定义音乐 URL:
* **server** *[必需]*
音乐的链接。
* **type** *[可选]*
音乐的名称。
* **artist** *[可选]*
音乐的创作者。
* **cover** *[可选]*
音乐的封面链接。
一个使用自定义音乐 URL 的 `music` 示例:
```go-html-template
{{</* music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" */>}}
```
呈现的输出效果如下:
{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}}
## 2 音乐平台 URL 的自动识别 {#automatic-identification}
`music` shortcode 有一个命名参数来使用音乐平台 URL 的自动识别:
* **auto** *[必需]]***第一个**位置参数)
用来自动识别的音乐平台 URL, 支持 `netease`, `tencent` 和 `xiami` 平台。
一个使用音乐平台 URL 的自动识别的 `music` 示例:
```go-html-template
{{</* music auto="https://music.163.com/#/playlist?id=60198" */>}}
或者
{{</* music "https://music.163.com/#/playlist?id=60198" */>}}
```
呈现的输出效果如下:
{{< music auto="https://music.163.com/#/playlist?id=60198" >}}
## 3 自定义音乐平台,类型和 ID {#custom-server}
`music` shortcode 有以下命名参数来使用自定义音乐平台:
* **server** *[必需]***第一个**位置参数)
[`netease`, `tencent`, `kugou`, `xiami`, `baidu`]
音乐平台。
* **type** *[必需]***第二个**位置参数)
[`song`, `playlist`, `album`, `search`, `artist`]
音乐类型。
* **id** *[必需]***第三个**位置参数)
歌曲 ID, 或者播放列表 ID, 或者专辑 ID, 或者搜索关键词,或者创作者 ID.
一个使用自定义音乐平台的 `music` 示例:
```go-html-template
{{</* music server="netease" type="song" id="1868553" */>}}
或者
{{</* music netease song 1868553 */>}}
```
呈现的输出效果如下:
{{< music netease song 1868553 >}}
## 4 其它参数 {#other-parameters}
`music` shortcode 有一些可以应用于以上三种方式的其它命名参数:
* **theme** *[可选]*
{{< version 0.2.0 changed >}} 音乐播放器的主题色,默认值是 `#448aff`。
* **fixed** *[可选]*
是否开启固定模式,默认值是 `false`。
* **mini** *[可选]*
是否开启迷你模式,默认值是 `false`。
* **autoplay** *[可选]*
是否自动播放音乐,默认值是 `false`。
* **volume** *[可选]*
第一次打开播放器时的默认音量,会被保存在浏览器缓存中,默认值是 `0.7`。
* **mutex** *[可选]*
是否自动暂停其它播放器,默认值是 `true`。
`music` shortcode 还有一些只适用于音乐列表方式的其它命名参数:
* **loop** *[可选]*
[`all`, `one`, `none`]
音乐列表的循环模式,默认值是 `none`。
* **order** *[可选]*
[`list`, `random`]
音乐列表的播放顺序,默认值是 `list`。
* **list-folded** *[可选]*
初次打开的时候音乐列表是否折叠,默认值是 `false`。
* **list-max-height** *[可选]*
音乐列表的最大高度,默认值是 `340px`。
Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

@@ -0,0 +1,110 @@
---
title: "Extended Shortcode - typeit"
date: 2022-07-20T13:56:03+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "The typeit shortcode provides typing animation based on TypeIt library."
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
---
The `typeit` shortcode provides typing animation based on [TypeIt](https://typeitjs.com/) library.
<!--more-->
Just insert your content in the `typeit` shortcode and thats it.
## 1 Simple Content {#simple-content}
Simple content is allowed in `Markdown` format and **without** rich block content such as images and more...
Example `typeit` input:
```go-html-template
{{</* typeit */>}}
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
{{</* /typeit */>}}
```
The rendered output looks like this:
{{< typeit >}}
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
{{< /typeit >}}
Alternatively, you can use custom **HTML tags**.
Example `typeit` input with `h4` tag:
```go-html-template
{{</* typeit tag=h4 */>}}
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
{{</* /typeit */>}}
```
The rendered output looks like this:
{{< typeit tag=h4 >}}
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
{{< /typeit >}}
## 2 Code Content {#code-content}
Code content is allowed and will be highlighted by named parameter `code` for the type of code language.
Example `typeit` input with `code`:
```go-html-template
{{</* typeit code=java */>}}
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World");
}
}
{{</* /typeit */>}}
```
The rendered output looks like this:
{{< typeit code=java >}}
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World");
}
}
{{< /typeit >}}
## 3 Group Content {#group-content}
All typing animations start at the same time by default.
But sometimes you may want to start a set of `typeit` contents in order.
A set of `typeit` contents with the same value of named parameter `group` will start typing animation in sequence.
Example `typeit` input with `group`:
```go-html-template
{{</* typeit group=paragraph */>}}
**First** this paragraph begins
{{</* /typeit */>}}
{{</* typeit group=paragraph */>}}
**Then** this paragraph begins
{{</* /typeit */>}}
```
The rendered output looks like this:
{{< typeit group=paragraph >}}
**First** this paragraph begins
{{< /typeit >}}
{{< typeit group=paragraph >}}
**Then** this paragraph begins
{{< /typeit >}}
@@ -0,0 +1,110 @@
---
title: "扩展 Shortcode - typeit"
date: 2022-07-20T13:56:03+08:00
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "typeit shortcode 基于 TypeIt 提供了打字动画。"
resources:
- name: "featured-image"
src: "featured-image.jpg"
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: true
---
`typeit` shortcode 基于 [TypeIt](https://typeitjs.com/) 提供了打字动画。
<!--more-->
只需将你需要打字动画的内容插入 `typeit` shortcode 中即可。
## 1 简单内容 {#simple-content}
允许使用 `Markdown` 格式的简单内容,并且 **不包含** 富文本的块内容,例如图像等等 ...
一个 `typeit` 示例:
```go-html-template
{{</* typeit */>}}
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
{{</* /typeit */>}}
```
呈现的输出效果如下:
{{< typeit >}}
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
{{< /typeit >}}
另外,你也可以自定义 **HTML 标签**.
一个带有 `h4` 标签的 `typeit` 示例:
```go-html-template
{{</* typeit tag=h4 */>}}
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
{{</* /typeit */>}}
```
呈现的输出效果如下:
{{< typeit tag=h4 >}}
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
{{< /typeit >}}
## 2 代码内容 {#code-content}
代码内容也是允许的,并且通过使用参数 `code` 指定语言类型可以实习语法高亮。
一个带有 `code` 参数的 `typeit` 示例:
```go-html-template
{{</* typeit code=java */>}}
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World");
}
}
{{</* /typeit */>}}
```
呈现的输出效果如下:
{{< typeit code=java >}}
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World");
}
}
{{< /typeit >}}
## 3 分组内容 {#code-content}
默认情况下,所有打字动画都是同时开始的。
但是有时你可能需要按顺序开始一组 `typeit` 内容的打字动画。
一组具有相同 `group` 参数值的 `typeit` 内容将按顺序开始打字动画。
一个带有 `group` 参数的 `typeit` 示例:
```go-html-template
{{</* typeit group=paragraph */>}}
**首先**, 这个段落开始
{{</* /typeit */>}}
{{</* typeit group=paragraph */>}}
**然后**, 这个段落开始
{{</* /typeit */>}}
```
呈现的输出效果如下:
{{< typeit group=paragraph >}}
**首先**, 这个段落开始
{{< /typeit >}}
{{< typeit group=paragraph >}}
**然后**, 这个段落开始
{{< /typeit >}}
@@ -327,750 +327,33 @@ The full documentation is provided in [Extended Shortcode - mermaid](../extended
## 6 echarts
[ECharts](https://echarts.apache.org/) is a library helping you to generate interactive data visualization.
The `echarts` shortcode supports data visualization in Hugo with [ECharts](https://echarts.apache.org/) library.
The basic chart types ECharts supports include [line series](https://echarts.apache.org/en/option.html#series-line), [bar series](https://echarts.apache.org/en/option.html#series-line), [scatter series](https://echarts.apache.org/en/option.html#series-scatter), [pie charts](https://echarts.apache.org/en/option.html#series-pie), [candle-stick series](https://echarts.apache.org/en/option.html#series-candlestick), [boxplot series](https://echarts.apache.org/en/option.html#series-boxplot) for statistics, [map series](https://echarts.apache.org/en/option.html#series-map), [heatmap series](https://echarts.apache.org/en/option.html#series-heatmap), [lines series](https://echarts.apache.org/en/option.html#series-lines) for directional information, [graph series](https://echarts.apache.org/en/option.html#series-graph) for relationships, [treemap series](https://echarts.apache.org/en/option.html#series-treemap), [sunburst series](https://echarts.apache.org/en/option.html#series-sunburst), [parallel series](https://echarts.apache.org/en/option.html#series-parallel) for multi-dimensional data, [funnel series](https://echarts.apache.org/en/option.html#series-funnel), [gauge series](https://echarts.apache.org/en/option.html#series-gauge). And it's extremely easy to create a combinition of them with ECharts.
Just insert your ECharts option in `JSON`/`YAML`/`TOML` format in the `echarts` shortcode and thats it.
Example `echarts` input in `JSON` format:
```json
{{</* echarts */>}}
{
"title": {
"text": "Summary Line Chart",
"top": "2%",
"left": "center"
},
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["Email Marketing", "Affiliate Advertising", "Video Advertising", "Direct View", "Search Engine"],
"top": "10%"
},
"grid": {
"left": "5%",
"right": "5%",
"bottom": "5%",
"top": "20%",
"containLabel": true
},
"toolbox": {
"feature": {
"saveAsImage": {
"title": "Save as Image"
}
}
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
},
"yAxis": {
"type": "value"
},
"series": [
{
"name": "Email Marketing",
"type": "line",
"stack": "Total",
"data": [120, 132, 101, 134, 90, 230, 210]
},
{
"name": "Affiliate Advertising",
"type": "line",
"stack": "Total",
"data": [220, 182, 191, 234, 290, 330, 310]
},
{
"name": "Video Advertising",
"type": "line",
"stack": "Total",
"data": [150, 232, 201, 154, 190, 330, 410]
},
{
"name": "Direct View",
"type": "line",
"stack": "Total",
"data": [320, 332, 301, 334, 390, 330, 320]
},
{
"name": "Search Engine",
"type": "line",
"stack": "Total",
"data": [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
{{</* /echarts */>}}
```
The same in `YAML` format:
```yaml
{{</* echarts */>}}
title:
text: Summary Line Chart
top: 2%
left: center
tooltip:
trigger: axis
legend:
data:
- Email Marketing
- Affiliate Advertising
- Video Advertising
- Direct View
- Search Engine
top: 10%
grid:
left: 5%
right: 5%
bottom: 5%
top: 20%
containLabel: true
toolbox:
feature:
saveAsImage:
title: Save as Image
xAxis:
type: category
boundaryGap: false
data:
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Saturday
- Sunday
yAxis:
type: value
series:
- name: Email Marketing
type: line
stack: Total
data:
- 120
- 132
- 101
- 134
- 90
- 230
- 210
- name: Affiliate Advertising
type: line
stack: Total
data:
- 220
- 182
- 191
- 234
- 290
- 330
- 310
- name: Video Advertising
type: line
stack: Total
data:
- 150
- 232
- 201
- 154
- 190
- 330
- 410
- name: Direct View
type: line
stack: Total
data:
- 320
- 332
- 301
- 334
- 390
- 330
- 320
- name: Search Engine
type: line
stack: Total
data:
- 820
- 932
- 901
- 934
- 1290
- 1330
- 1320
{{</* /echarts */>}}
```
The same in `TOML` format:
```toml
{{</* echarts */>}}
[title]
text = "Summary Line Chart"
top = "2%"
left = "center"
[tooltip]
trigger = "axis"
[legend]
data = [
"Email Marketing",
"Affiliate Advertising",
"Video Advertising",
"Direct View",
"Search Engine"
]
top = "10%"
[grid]
left = "5%"
right = "5%"
bottom = "5%"
top = "20%"
containLabel = true
[toolbox]
[toolbox.feature]
[toolbox.feature.saveAsImage]
title = "Save as Image"
[xAxis]
type = "category"
boundaryGap = false
data = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
]
[yAxis]
type = "value"
[[series]]
name = "Email Marketing"
type = "line"
stack = "Total"
data = [
120.0,
132.0,
101.0,
134.0,
90.0,
230.0,
210.0
]
[[series]]
name = "Affiliate Advertising"
type = "line"
stack = "Total"
data = [
220.0,
182.0,
191.0,
234.0,
290.0,
330.0,
310.0
]
[[series]]
name = "Video Advertising"
type = "line"
stack = "Total"
data = [
150.0,
232.0,
201.0,
154.0,
190.0,
330.0,
410.0
]
[[series]]
name = "Direct View"
type = "line"
stack = "Total"
data = [
320.0,
332.0,
301.0,
334.0,
390.0,
330.0,
320.0
]
[[series]]
name = "Search Engine"
type = "line"
stack = "Total"
data = [
820.0,
932.0,
901.0,
934.0,
1290.0,
1330.0,
1320.0
]
{{</* /echarts */>}}
```
The rendered output looks like this:
{{< echarts >}}
{
"title": {
"text": "Summary Line Chart",
"top": "2%",
"left": "center"
},
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["Email Marketing", "Affiliate Advertising", "Video Advertising", "Direct View", "Search Engine"],
"top": "10%"
},
"grid": {
"left": "5%",
"right": "5%",
"bottom": "5%",
"top": "20%",
"containLabel": true
},
"toolbox": {
"feature": {
"saveAsImage": {
"title": "Save as Image"
}
}
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
},
"yAxis": {
"type": "value"
},
"series": [
{
"name": "Email Marketing",
"type": "line",
"stack": "Total",
"data": [120, 132, 101, 134, 90, 230, 210]
},
{
"name": "Affiliate Advertising",
"type": "line",
"stack": "Total",
"data": [220, 182, 191, 234, 290, 330, 310]
},
{
"name": "Video Advertising",
"type": "line",
"stack": "Total",
"data": [150, 232, 201, 154, 190, 330, 410]
},
{
"name": "Direct View",
"type": "line",
"stack": "Total",
"data": [320, 332, 301, 334, 390, 330, 320]
},
{
"name": "Search Engine",
"type": "line",
"stack": "Total",
"data": [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
{{< /echarts >}}
The `echarts` shortcode has also the following named parameters:
* **width** *[optional]* (**first** positional parameter)
{{< version 0.2.0 >}} Width of the data visualization, default value is `100%`.
* **height** *[optional]* (**second** positional parameter)
{{< version 0.2.0 >}} Height of the data visualization, default value is `30rem`.
The full documentation is provided in [Extended Shortcode - echarts](../extended-shortcode-echarts/).
## 7 mapbox
{{< version 0.2.0 >}}
The `mapbox` shortcode supports interactive maps in Hugo with [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) library.
[Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) is a JavaScript library that uses WebGL to render interactive maps from [vector tiles](https://docs.mapbox.com/help/glossary/vector-tiles/) and [Mapbox styles](https://docs.mapbox.com/mapbox-gl-js/style-spec/).
The `mapbox` shortcode has the following named parameters to use Mapbox GL JS:
* **lng** *[required]* (**first** positional parameter)
Longitude of the inital centerpoint of the map, measured in degrees.
* **lat** *[required]* (**second** positional parameter)
Latitude of the inital centerpoint of the map, measured in degrees.
* **zoom** *[optional]* (**third** positional parameter)
The initial zoom level of the map, default value is `10`.
* **marked** *[optional]* (**fourth** positional parameter)
Whether to add a marker at the inital centerpoint of the map, default value is `true`.
* **light-style** *[optional]* (**fifth** positional parameter)
Style for the light theme, default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **dark-style** *[optional]* (**sixth** positional parameter)
Style for the dark theme, default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **navigation** *[optional]*
Whether to add [NavigationControl](https://docs.mapbox.com/mapbox-gl-js/api#navigationcontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **geolocate** *[optional]*
Whether to add [GeolocateControl](https://docs.mapbox.com/mapbox-gl-js/api#geolocatecontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **scale** *[optional]*
Whether to add [ScaleControl](https://docs.mapbox.com/mapbox-gl-js/api#scalecontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **fullscreen** *[optional]*
Whether to add [FullscreenControl](https://docs.mapbox.com/mapbox-gl-js/api#fullscreencontrol), default value is the value set in the [front matter](../theme-documentation-content#front-matter) or the [site configuration](../theme-documentation-basics#site-configuration).
* **width** *[optional]*
Width of the map, default value is `100%`.
* **height** *[optional]*
Height of the map, default value is `20rem`.
Example simple `mapbox` input:
```go-html-template
{{</* mapbox 113.953277 22.559102 11 */>}}
Or
{{</* mapbox lng=113.953277 lat=22.559102 zoom=11 */>}}
```
The rendered output looks like this:
{{< mapbox 113.953277 22.559102 11 >}}
Example `mapbox` input with the custom style:
```go-html-template
{{</* mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/navigation-preview-day-v4" "mapbox://styles/mapbox/navigation-preview-night-v4" */>}}
Or
{{</* mapbox lng=-122.252 lat=37.453 zoom=10 marked=false light-style="mapbox://styles/mapbox/navigation-preview-day-v4" dark-style="mapbox://styles/mapbox/navigation-preview-night-v4" */>}}
```
The rendered output looks like this:
{{< mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/navigation-preview-day-v4?optimize=true" "mapbox://styles/mapbox/navigation-preview-night-v4?optimize=true" >}}
The full documentation is provided in [Extended Shortcode - mapbox](../extended-shortcode-mapbox/).
## 8 music
The `music` shortcode embeds a responsive music player based on [APlayer](https://github.com/MoePlayer/APlayer) and [MetingJS](https://github.com/metowolf/MetingJS).
The `music` shortcode embeds a responsive music player based on [APlayer](https://github.com/MoePlayer/APlayer) and [MetingJS](https://github.com/metowolf/MetingJS) library.
There are three ways to use it the `music` shortcode.
### 8.1 Custom Music URL {#custom-music-url}
{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported.
The `music` shortcode has the following named parameters by custom music URL:
* **server** *[required]*
URL of the custom music.
* **name** *[optional]*
Name of the custom music.
* **artist** *[optional]*
Artist of the custom music.
* **cover** *[required]*
URL of the custom music cover.
Example `music` input by custom music URL:
```go-html-template
{{</* music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" */>}}
```
The rendered output looks like this:
{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}}
### 8.2 Music Platform URL Automatic Identification {#automatic-identification}
The `music` shortcode has one named parameter by music platform URL automatic identification:
* **auto** *[required]* (**first** positional parameter)
URL of the music platform URL for automatic identification,
which supports `netease`, `tencent` and `xiami` music platform.
Example `music` input by music platform URL automatic identification:
```go-html-template
{{</* music auto="https://music.163.com/#/playlist?id=60198" */>}}
Or
{{</* music "https://music.163.com/#/playlist?id=60198" */>}}
```
The rendered output looks like this:
{{< music auto="https://music.163.com/#/playlist?id=60198" >}}
### 8.3 Custom Server, Type and ID {#custom-server}
The `music` shortcode has the following named parameters by custom music platform:
* **server** *[required]* (**first** positional parameter)
[`netease`, `tencent`, `kugou`, `xiami`, `baidu`]
Music platform.
* **type** *[required]* (**second** positional parameter)
[`song`, `playlist`, `album`, `search`, `artist`]
Type of the music.
* **id** *[required]* (**third** positional parameter)
Song ID, or playlist ID, or album ID, or search keyword, or artist ID.
Example `music` input by custom music platform:
```go-html-template
{{</* music server="netease" type="song" id="1868553" */>}}
Or
{{</* music netease song 1868553 */>}}
```
The rendered output looks like this:
{{< music netease song 1868553 >}}
### 8.4 Other Parameters {#other-parameters}
The `music` shortcode has other named parameters applying to the above three ways:
* **theme** *[optional]*
{{< version 0.2.0 changed >}} Main color of the music player, default value is `#448aff`.
* **fixed** *[optional]*
Whether to enable fixed mode, default value is `false`.
* **mini** *[optional]*
Whether to enable mini mode, default value is `false`.
* **autoplay** *[optional]*
Whether to autoplay music, default value is `false`.
* **volume** *[optional]*
Default volume when the player is first opened, which will be remembered in the browser, default value is `0.7`.
* **mutex** *[optional]*
Whether to pause other players when this player starts playing, default value is `true`.
The `music` shortcode has the following named parameters only applying to the type of music list:
* **loop** *[optional]*
[`all`, `one`, `none`]
Loop mode of the music list, default value is `none`.
* **order** *[optional]*
[`list`, `random`]
Play order of the music list, default value is `list`.
* **list-folded** *[optional]*
Whether the music list should be folded at first, default value is `false`.
* **list-max-height** *[optional]*
Max height of the music list, default value is `340px`.
The full documentation is provided in [Extended Shortcode - music](../extended-shortcode-music/).
## 9 bilibili
{{< version 0.2.0 changed >}}
The `bilibili` shortcode embeds a responsive video player for bilibili videos.
When the video only has one part, only the BV `id` of the video is required, e.g.:
```code
https://www.bilibili.com/video/BV1Sx411T7QQ
```
Example `bilibili` input:
```go-html-template
{{</* bilibili BV1Sx411T7QQ */>}}
Or
{{</* bilibili id=BV1Sx411T7QQ */>}}
```
The rendered output looks like this:
{{< bilibili id=BV1Sx411T7QQ >}}
When the video has multiple parts, in addition to the BV `id` of the video,
`p` is also required, whose default value is `1`, e.g.:
```code
https://www.bilibili.com/video/BV1TJ411C7An?p=3
```
Example `bilibili` input with `p`:
```go-html-template
{{</* bilibili BV1TJ411C7An 3 */>}}
Or
{{</* bilibili id=BV1TJ411C7An p=3 */>}}
```
The rendered output looks like this:
{{< bilibili id=BV1TJ411C7An p=3 >}}
The full documentation is provided in [Extended Shortcode - bilibili](../extended-shortcode-bilibili/).
## 10 typeit
The `typeit` shortcode provides typing animation based on [TypeIt](https://typeitjs.com/).
Just insert your content in the `typeit` shortcode and thats it.
### 10.1 Simple Content {#simple-content}
Simple content is allowed in `Markdown` format and **without** rich block content such as images and more...
Example `typeit` input:
```go-html-template
{{</* typeit */>}}
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
{{</* /typeit */>}}
```
The rendered output looks like this:
{{< typeit >}}
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
{{< /typeit >}}
Alternatively, you can use custom **HTML tags**.
Example `typeit` input with `h4` tag:
```go-html-template
{{</* typeit tag=h4 */>}}
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
{{</* /typeit */>}}
```
The rendered output looks like this:
{{< typeit tag=h4 >}}
This is a *paragraph* with **typing animation** based on [TypeIt](https://typeitjs.com/)...
{{< /typeit >}}
### 10.2 Code Content {#code-content}
Code content is allowed and will be highlighted by named parameter `code` for the type of code language.
Example `typeit` input with `code`:
```go-html-template
{{</* typeit code=java */>}}
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World");
}
}
{{</* /typeit */>}}
```
The rendered output looks like this:
{{< typeit code=java >}}
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World");
}
}
{{< /typeit >}}
### 10.3 Group Content {#group-content}
All typing animations start at the same time by default.
But sometimes you may want to start a set of `typeit` contents in order.
A set of `typeit` contents with the same value of named parameter `group` will start typing animation in sequence.
Example `typeit` input with `group`:
```go-html-template
{{</* typeit group=paragraph */>}}
**First** this paragraph begins
{{</* /typeit */>}}
{{</* typeit group=paragraph */>}}
**Then** this paragraph begins
{{</* /typeit */>}}
```
The rendered output looks like this:
{{< typeit group=paragraph >}}
**First** this paragraph begins
{{< /typeit >}}
{{< typeit group=paragraph >}}
**Then** this paragraph begins
{{< /typeit >}}
The full documentation is provided in [Extended Shortcode - typeit](../extended-shortcode-typeit/).
## 11 script
@@ -16,9 +16,6 @@ tags: ["shortcodes"]
categories: ["documentation"]
lightgallery: true
mapbox:
lightStyle: mapbox://styles/mapbox/light-zh-v1?optimize=true
darkStyle: mapbox://styles/mapbox/dark-zh-v1?optimize=true
menu:
main:
@@ -323,754 +320,39 @@ This is a **right-aligned** paragraph.
## 5 mermaid
`mermaid` shortcode 使用 [Mermaid](https://mermaidjs.github.io/) 库提供绘制图表和流程图的功能.
`mermaid` shortcode 使用 [Mermaid](https://mermaidjs.github.io/) 库提供绘制图表和流程图的功能
完整文档请查看页面 [扩展 Shortcode - mermaid](../extended-shortcode-mermaid/).
完整文档请查看页面 [扩展 Shortcode - mermaid](../extended-shortcode-mermaid/)
## 6 echarts
[ECharts](https://echarts.apache.org/) 是一个帮助你生成交互式数据可视化的
`echarts` shortcode 使用 [ECharts](https://echarts.apache.org/) 库提供数据可视化的功能
ECharts 提供了常规的 [折线图](https://echarts.apache.org/zh/option.html#series-line), [柱状图](https://echarts.apache.org/zh/option.html#series-line), [散点图](https://echarts.apache.org/zh/option.html#series-scatter), [饼图](https://echarts.apache.org/zh/option.html#series-pie), [K 线图](https://echarts.apache.org/zh/option.html#series-candlestick), 用于统计的 [盒形图](https://echarts.apache.org/zh/option.html#series-boxplot), 用于地理数据可视化的 [地图](https://echarts.apache.org/zh/option.html#series-map), [热力图](https://echarts.apache.org/zh/option.html#series-heatmap), [线图](https://echarts.apache.org/zh/option.html#series-lines), 用于关系数据可视化的 [关系图](https://echarts.apache.org/zh/option.html#series-graph), [treemap](https://echarts.apache.org/zh/option.html#series-treemap), [旭日图](https://echarts.apache.org/zh/option.html#series-sunburst), 多维数据可视化的 [平行坐标](https://echarts.apache.org/zh/option.html#series-parallel), 还有用于 BI 的 [漏斗图](https://echarts.apache.org/zh/option.html#series-funnel), [仪表盘](https://echarts.apache.org/zh/option.html#series-gauge), 并且支持图与图之间的混搭
只需在 `echarts` shortcode 中以 `JSON`/`YAML`/`TOML`格式插入 ECharts 选项即可。
一个 `JSON` 格式的 `echarts` 示例:
```json
{{</* echarts */>}}
{
"title": {
"text": "折线统计图",
"top": "2%",
"left": "center"
},
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["邮件营销", "联盟广告", "视频广告", "直接访问", "搜索引擎"],
"top": "10%"
},
"grid": {
"left": "5%",
"right": "5%",
"bottom": "5%",
"top": "20%",
"containLabel": true
},
"toolbox": {
"feature": {
"saveAsImage": {
"title": "保存为图片"
}
}
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
},
"yAxis": {
"type": "value"
},
"series": [
{
"name": "邮件营销",
"type": "line",
"stack": "总量",
"data": [120, 132, 101, 134, 90, 230, 210]
},
{
"name": "联盟广告",
"type": "line",
"stack": "总量",
"data": [220, 182, 191, 234, 290, 330, 310]
},
{
"name": "视频广告",
"type": "line",
"stack": "总量",
"data": [150, 232, 201, 154, 190, 330, 410]
},
{
"name": "直接访问",
"type": "line",
"stack": "总量",
"data": [320, 332, 301, 334, 390, 330, 320]
},
{
"name": "搜索引擎",
"type": "line",
"stack": "总量",
"data": [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
{{</* /echarts */>}}
```
一个 `YAML` 格式的 `echarts` 示例:
```yaml
{{</* echarts */>}}
title:
text: 折线统计图
top: 2%
left: center
tooltip:
trigger: axis
legend:
data:
- 邮件营销
- 联盟广告
- 视频广告
- 直接访问
- 搜索引擎
top: 10%
grid:
left: 5%
right: 5%
bottom: 5%
top: 20%
containLabel: true
toolbox:
feature:
saveAsImage:
title: 保存为图片
xAxis:
type: category
boundaryGap: false
data:
- 周一
- 周二
- 周三
- 周四
- 周五
- 周六
- 周日
yAxis:
type: value
series:
- name: 邮件营销
type: line
stack: 总量
data:
- 120
- 132
- 101
- 134
- 90
- 230
- 210
- name: 联盟广告
type: line
stack: 总量
data:
- 220
- 182
- 191
- 234
- 290
- 330
- 310
- name: 视频广告
type: line
stack: 总量
data:
- 150
- 232
- 201
- 154
- 190
- 330
- 410
- name: 直接访问
type: line
stack: 总量
data:
- 320
- 332
- 301
- 334
- 390
- 330
- 320
- name: 搜索引擎
type: line
stack: 总量
data:
- 820
- 932
- 901
- 934
- 1290
- 1330
- 1320
{{</* /echarts */>}}
```
一个 `TOML` 格式的 `echarts` 示例:
```toml
{{</* echarts */>}}
[title]
text = "折线统计图"
top = "2%"
left = "center"
[tooltip]
trigger = "axis"
[legend]
data = [
"邮件营销",
"联盟广告",
"视频广告",
"直接访问",
"搜索引擎"
]
top = "10%"
[grid]
left = "5%"
right = "5%"
bottom = "5%"
top = "20%"
containLabel = true
[toolbox]
[toolbox.feature]
[toolbox.feature.saveAsImage]
title = "保存为图片"
[xAxis]
type = "category"
boundaryGap = false
data = [
"周一",
"周二",
"周三",
"周四",
"周五",
"周六",
"周日"
]
[yAxis]
type = "value"
[[series]]
name = "邮件营销"
type = "line"
stack = "总量"
data = [
120.0,
132.0,
101.0,
134.0,
90.0,
230.0,
210.0
]
[[series]]
name = "联盟广告"
type = "line"
stack = "总量"
data = [
220.0,
182.0,
191.0,
234.0,
290.0,
330.0,
310.0
]
[[series]]
name = "视频广告"
type = "line"
stack = "总量"
data = [
150.0,
232.0,
201.0,
154.0,
190.0,
330.0,
410.0
]
[[series]]
name = "直接访问"
type = "line"
stack = "总量"
data = [
320.0,
332.0,
301.0,
334.0,
390.0,
330.0,
320.0
]
[[series]]
name = "搜索引擎"
type = "line"
stack = "总量"
data = [
820.0,
932.0,
901.0,
934.0,
1290.0,
1330.0,
1320.0
]
{{</* /echarts */>}}
```
呈现的输出效果如下:
{{< echarts >}}
{
"title": {
"text": "折线统计图",
"top": "2%",
"left": "center"
},
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["邮件营销", "联盟广告", "视频广告", "直接访问", "搜索引擎"],
"top": "10%"
},
"grid": {
"left": "5%",
"right": "5%",
"bottom": "5%",
"top": "20%",
"containLabel": true
},
"toolbox": {
"feature": {
"saveAsImage": {
"title": "保存为图片"
}
}
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
},
"yAxis": {
"type": "value"
},
"series": [
{
"name": "邮件营销",
"type": "line",
"stack": "总量",
"data": [120, 132, 101, 134, 90, 230, 210]
},
{
"name": "联盟广告",
"type": "line",
"stack": "总量",
"data": [220, 182, 191, 234, 290, 330, 310]
},
{
"name": "视频广告",
"type": "line",
"stack": "总量",
"data": [150, 232, 201, 154, 190, 330, 410]
},
{
"name": "直接访问",
"type": "line",
"stack": "总量",
"data": [320, 332, 301, 334, 390, 330, 320]
},
{
"name": "搜索引擎",
"type": "line",
"stack": "总量",
"data": [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
{{< /echarts >}}
`echarts` shortcode 还有以下命名参数:
* **width** *[可选]***第一个**位置参数)
{{< version 0.2.0 >}} 数据可视化的宽度,默认值是 `100%`。
* **height** *[可选]***第二个**位置参数)
{{< version 0.2.0 >}} 数据可视化的高度,默认值是 `30rem`。
完整文档请查看页面 [扩展 Shortcode - echarts](../extended-shortcode-echarts/)
## 7 mapbox
{{< version 0.2.0 >}}
`mapbox` shortcode 使用 [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) 库提供互动式地图的功能。
[Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) 是一个 JavaScript 库,它使用 WebGL, 以 [vector tiles](https://docs.mapbox.com/help/glossary/vector-tiles/) 和 [Mapbox styles](https://docs.mapbox.com/mapbox-gl-js/style-spec/) 为来源,将它们渲染成互动式地图
`mapbox` shortcode 有以下命名参数来使用 Mapbox GL JS:
* **lng** *[必需]***第一个**位置参数)
地图初始中心点的经度,以度为单位。
* **lat** *[必需]***第二个**位置参数)
地图初始中心点的纬度,以度为单位。
* **zoom** *[可选]***第三个**位置参数)
地图的初始缩放级别,默认值是 `10`。
* **marked** *[可选]***第四个**位置参数)
是否在地图的初始中心点添加图钉,默认值是 `true`。
* **light-style** *[可选]***第五个**位置参数)
浅色主题的地图样式,默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **dark-style** *[可选]***第六个**位置参数)
深色主题的地图样式,默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **navigation** *[可选]*
是否添加 [NavigationControl](https://docs.mapbox.com/mapbox-gl-js/api#navigationcontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **geolocate** *[可选]*
是否添加 [GeolocateControl](https://docs.mapbox.com/mapbox-gl-js/api#geolocatecontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **scale** *[可选]*
是否添加 [ScaleControl](https://docs.mapbox.com/mapbox-gl-js/api#scalecontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **fullscreen** *[可选]*
是否添加 [FullscreenControl](https://docs.mapbox.com/mapbox-gl-js/api#fullscreencontrol), 默认值是 [前置参数](../theme-documentation-content#front-matter) 或者 [网站配置](../theme-documentation-basics#site-configuration) 中设置的值。
* **width** *[可选]*
地图的宽度,默认值是 `100%`。
* **height** *[可选]*
地图的高度,默认值是 `20rem`。
一个简单的 `mapbox` 示例:
```go-html-template
{{</* mapbox 113.953277 22.559102 11 */>}}
或者
{{</* mapbox lng=113.953277 lat=22.559102 zoom=11 */>}}
```
呈现的输出效果如下:
{{< mapbox 113.953277 22.559102 11 >}}
一个带有自定义样式的 `mapbox` 示例:
```go-html-template
{{</* mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/streets-zh-v1" */>}}
或者
{{</* mapbox lng=-122.252 lat=37.453 zoom=10 marked=false light-style="mapbox://styles/mapbox/streets-zh-v1" */>}}
```
呈现的输出效果如下:
{{< mapbox -122.252 37.453 10 false "mapbox://styles/mapbox/streets-zh-v1?optimize=true" >}}
完整文档请查看页面 [扩展 Shortcode - mapbox](../extended-shortcode-mapbox/)
## 8 music
`music` shortcode 基于 [APlayer](https://github.com/MoePlayer/APlayer) 和 [MetingJS](https://github.com/metowolf/MetingJS) 提供了一个内嵌的响应式音乐播放器。
`music` shortcode 基于 [APlayer](https://github.com/MoePlayer/APlayer) 和 [MetingJS](https://github.com/metowolf/MetingJS) 提供了一个内嵌的响应式音乐播放器。
有三种方式使用 `music` shortcode.
### 8.1 自定义音乐 URL {#custom-music-url}
{{< version 0.2.10 >}} 支持 [本地资源引用](../theme-documentation-content#contents-organization) 的完整用法。
`music` shortcode 有以下命名参数来使用自定义音乐 URL:
* **server** *[必需]*
音乐的链接。
* **type** *[可选]*
音乐的名称。
* **artist** *[可选]*
音乐的创作者。
* **cover** *[可选]*
音乐的封面链接。
一个使用自定义音乐 URL 的 `music` 示例:
```go-html-template
{{</* music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" */>}}
```
呈现的输出效果如下:
{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}}
### 8.2 音乐平台 URL 的自动识别 {#automatic-identification}
`music` shortcode 有一个命名参数来使用音乐平台 URL 的自动识别:
* **auto** *[必需]]***第一个**位置参数)
用来自动识别的音乐平台 URL, 支持 `netease`, `tencent` 和 `xiami` 平台。
一个使用音乐平台 URL 的自动识别的 `music` 示例:
```go-html-template
{{</* music auto="https://music.163.com/#/playlist?id=60198" */>}}
或者
{{</* music "https://music.163.com/#/playlist?id=60198" */>}}
```
呈现的输出效果如下:
{{< music auto="https://music.163.com/#/playlist?id=60198" >}}
### 8.3 自定义音乐平台,类型和 ID {#custom-server}
`music` shortcode 有以下命名参数来使用自定义音乐平台:
* **server** *[必需]***第一个**位置参数)
[`netease`, `tencent`, `kugou`, `xiami`, `baidu`]
音乐平台。
* **type** *[必需]***第二个**位置参数)
[`song`, `playlist`, `album`, `search`, `artist`]
音乐类型。
* **id** *[必需]***第三个**位置参数)
歌曲 ID, 或者播放列表 ID, 或者专辑 ID, 或者搜索关键词,或者创作者 ID.
一个使用自定义音乐平台的 `music` 示例:
```go-html-template
{{</* music server="netease" type="song" id="1868553" */>}}
或者
{{</* music netease song 1868553 */>}}
```
呈现的输出效果如下:
{{< music netease song 1868553 >}}
### 8.4 其它参数 {#other-parameters}
`music` shortcode 有一些可以应用于以上三种方式的其它命名参数:
* **theme** *[可选]*
{{< version 0.2.0 changed >}} 音乐播放器的主题色,默认值是 `#448aff`。
* **fixed** *[可选]*
是否开启固定模式,默认值是 `false`。
* **mini** *[可选]*
是否开启迷你模式,默认值是 `false`。
* **autoplay** *[可选]*
是否自动播放音乐,默认值是 `false`。
* **volume** *[可选]*
第一次打开播放器时的默认音量,会被保存在浏览器缓存中,默认值是 `0.7`。
* **mutex** *[可选]*
是否自动暂停其它播放器,默认值是 `true`。
`music` shortcode 还有一些只适用于音乐列表方式的其它命名参数:
* **loop** *[可选]*
[`all`, `one`, `none`]
音乐列表的循环模式,默认值是 `none`。
* **order** *[可选]*
[`list`, `random`]
音乐列表的播放顺序,默认值是 `list`。
* **list-folded** *[可选]*
初次打开的时候音乐列表是否折叠,默认值是 `false`。
* **list-max-height** *[可选]*
音乐列表的最大高度,默认值是 `340px`。
完整文档请查看页面 [扩展 Shortcode - music](../extended-shortcode-music/)。
## 9 bilibili
{{< version 0.2.0 changed >}}
`bilibili` shortcode 提供了一个内嵌的用来播放 bilibili 视频的响应式播放器。
如果视频只有一个部分,则仅需要视频的 BV `id`, 例如:
```code
https://www.bilibili.com/video/BV1Sx411T7QQ
```
一个 `bilibili` 示例:
```go-html-template
{{</* bilibili BV1Sx411T7QQ */>}}
或者
{{</* bilibili id=BV1Sx411T7QQ */>}}
```
呈现的输出效果如下:
{{< bilibili id=BV1Sx411T7QQ >}}
如果视频包含多个部分,则除了视频的 BV `id` 之外,还需要 `p`, 默认值为 `1`, 例如:
```code
https://www.bilibili.com/video/BV1TJ411C7An?p=3
```
一个带有 `p` 参数的 `bilibili` 示例:
```go-html-template
{{</* bilibili BV1TJ411C7An 3 */>}}
或者
{{</* bilibili id=BV1TJ411C7An p=3 */>}}
```
呈现的输出效果如下:
{{< bilibili id=BV1TJ411C7An p=3 >}}
完整文档请查看页面 [扩展 Shortcode - bilibili](../extended-shortcode-bilibili/)。
## 10 typeit
`typeit` shortcode 基于 [TypeIt](https://typeitjs.com/) 提供了打字动画。
只需将你需要打字动画的内容插入 `typeit` shortcode 中即可
### 10.1 简单内容 {#simple-content}
允许使用 `Markdown` 格式的简单内容,并且 **不包含** 富文本的块内容,例如图像等等 ...
一个 `typeit` 示例:
```go-html-template
{{</* typeit */>}}
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
{{</* /typeit */>}}
```
呈现的输出效果如下:
{{< typeit >}}
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
{{< /typeit >}}
另外,你也可以自定义 **HTML 标签**.
一个带有 `h4` 标签的 `typeit` 示例:
```go-html-template
{{</* typeit tag=h4 */>}}
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
{{</* /typeit */>}}
```
呈现的输出效果如下:
{{< typeit tag=h4 >}}
这一个带有基于 [TypeIt](https://typeitjs.com/) 的 **打字动画** 的 *段落* ...
{{< /typeit >}}
### 10.2 代码内容 {#code-content}
代码内容也是允许的,并且通过使用参数 `code` 指定语言类型可以实习语法高亮。
一个带有 `code` 参数的 `typeit` 示例:
```go-html-template
{{</* typeit code=java */>}}
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World");
}
}
{{</* /typeit */>}}
```
呈现的输出效果如下:
{{< typeit code=java >}}
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World");
}
}
{{< /typeit >}}
### 10.3 分组内容 {#code-content}
默认情况下,所有打字动画都是同时开始的。
但是有时你可能需要按顺序开始一组 `typeit` 内容的打字动画。
一组具有相同 `group` 参数值的 `typeit` 内容将按顺序开始打字动画。
一个带有 `group` 参数的 `typeit` 示例:
```go-html-template
{{</* typeit group=paragraph */>}}
**首先**, 这个段落开始
{{</* /typeit */>}}
{{</* typeit group=paragraph */>}}
**然后**, 这个段落开始
{{</* /typeit */>}}
```
呈现的输出效果如下:
{{< typeit group=paragraph >}}
**首先**, 这个段落开始
{{< /typeit >}}
{{< typeit group=paragraph >}}
**然后**, 这个段落开始
{{< /typeit >}}
完整文档请查看页面 [扩展 Shortcode - typeit](../extended-shortcode-typeit/)
## 11 script
@@ -1154,7 +436,7 @@ this is a center-quote shortcode example.
您可以使用 `fixit-encryptor` shortcode 来加密部分内容。
完整文档请查看页面 [主题文档 - 内容加密](../theme-documentation-content-encryption/#partial-encryption).
完整文档请查看页面 [主题文档 - 内容加密](../theme-documentation-content-encryption/#partial-encryption)
---
@@ -20,6 +20,8 @@ tags:
categories:
- Test
hiddenFromHomePage: true
menu:
main:
title: "Test for encrypting content"
@@ -18,6 +18,8 @@ tags:
categories:
- Test
hiddenFromHomePage: true
menu:
main:
title: "文章加密测试"
@@ -12,6 +12,8 @@ tags:
categories:
- Test
hiddenFromHomePage: true
menu:
main:
title: "Test for rendering Font Awesome icons"
@@ -12,6 +12,8 @@ tags:
categories:
- Test
hiddenFromHomePage: true
menu:
main:
title: "Test for code highlight feature"
@@ -12,6 +12,8 @@ tags:
categories:
- Test
hiddenFromHomePage: true
menu:
main:
title: "Test for Markdown rendering"
@@ -14,6 +14,8 @@ tags:
categories:
- Test
hiddenFromHomePage: true
code:
maxShownLines: 30
@@ -11,6 +11,8 @@ tags:
categories:
- Test
hiddenFromHomePage: true
menu:
main:
title: "Test for shortcodes usages"