2020-03-08 14:02:21 +01:00
---
weight: 3
title: "Theme Documentation - Shortcodes"
2020-03-16 09:14:37 +01:00
subtitle: ""
2020-03-08 14:02:21 +01:00
date: 2020-03-04T16:29:41+08:00
lastmod: 2020-03-04T16:29:41+08:00
draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "LoveIt theme provides multiple shortcodes on top of built-in ones in Hugo."
license: ""
tags: ["shortcodes"]
categories: ["documentation"]
hiddenFromHomePage: false
featuredImage: "/images/theme-documentation-shortcodes/featured-image.jpg"
featuredImagePreview: ""
toc: true
autoCollapseToc: true
math: false
lightgallery: true
linkToMarkdown: true
share:
enable: true
comment: true
---
**LoveIt** theme provides multiple shortcodes on top of built-in ones in Hugo.
<!-- more -->
Hugo uses Markdown for its simple content format. However, there are a lot of things that Markdown doesn’ t support well. You could use pure HTML to expand possibilities.
But this happens to be a bad idea. Everyone uses Markdown because it’ s pure and simple to read even non-rendered. You should avoid HTML to keep it as simple as possible.
To avoid this limitations, Hugo created [shortcodes ](https://gohugo.io/extras/shortcodes/ ).
A shortcode is a simple snippet that can generate reasonable HTML code and conforms to Markdown's design philosophy.
## Hugo’ s Built-in Shortcodes
Hugo ships with a set of predefined shortcodes that represent very common usage. These shortcodes are provided for author convenience and to keep your markdown content clean.
### `figure` {#figure}
[Documentation of `figure` ](https://gohugo.io/content-management/shortcodes/#figure )
2020-03-19 05:35:37 +01:00
Example `figure` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* figure src="/images/theme-documentation-shortcodes/lighthouse.jpg" title="Lighthouse (figure)" */>}}
```
The rendered output looks like this:
{{< figure src = "/images/theme-documentation-shortcodes/lighthouse.jpg" title = "Lighthouse (figure)" > }}
The HTML looks like this:
```html
< figure >
< img src = "/images/theme-documentation-shortcodes/lighthouse.jpg" / >
< figcaption >
< h4 > Lighthouse (figure)< / h4 >
< / figcaption >
< / figure >
```
### `gist`
[Documentation of `gist` ](https://gohugo.io/content-management/shortcodes/#gist )
2020-03-19 05:35:37 +01:00
Example `gist` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* gist spf13 7896402 */>}}
```
The rendered output looks like this:
{{< gist spf13 7896402 > }}
The HTML looks like this:
```html
< script type = "application/javascript" src = "https://gist.github.com/spf13/7896402.js" > < / script >
```
### `highlight`
[Documentation of `highlight` ](https://gohugo.io/content-management/shortcodes/#instagram )
2020-03-19 05:35:37 +01:00
Example `highlight` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* highlight html */>}}
< section id = "main" >
< div >
< h1 id = "title" > {{ .Title }}< / h1 >
{{ range .Pages }}
{{ .Render "summary"}}
{{ end }}
< / div >
< / section >
{{< /* /highlight */>}}
```
The rendered output looks like this:
{{< highlight html > }}
< section id = "main" >
< div >
< h1 id = "title" > {{ .Title }}< / h1 >
{{ range .Pages }}
{{ .Render "summary"}}
{{ end }}
< / div >
< / section >
{{< / highlight > }}
### `instagram`
[Documentation of `instagram` ](https://gohugo.io/content-management/shortcodes/#instagram )
2020-03-19 05:35:37 +01:00
Example `instagram` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* instagram BWNjjyYFxVx hidecaption */>}}
```
The rendered output looks like this:
{{< instagram BWNjjyYFxVx hidecaption > }}
### `param`
[Documentation of `param` ](https://gohugo.io/content-management/shortcodes/#param )
2020-03-19 05:35:37 +01:00
Example `param` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* param description */>}}
```
The rendered output looks like this:
{{< param description > }}
### `ref` and `relref` {#ref-and-relref}
[Documentation of `ref` and `relref` ](https://gohugo.io/content-management/shortcodes/#ref-and-relref )
### `tweet`
[Documentation of `tweet` ](https://gohugo.io/content-management/shortcodes/#tweet )
2020-03-19 05:35:37 +01:00
Example `tweet` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* tweet 877500564405444608 */>}}
```
The rendered output looks like this:
{{< tweet 877500564405444608 > }}
### `vimeo`
[Documentation of `vimeo` ](https://gohugo.io/content-management/shortcodes/#vimeo )
2020-03-19 05:35:37 +01:00
Example `vimeo` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* vimeo 146022717 */>}}
```
The rendered output looks like this:
{{< vimeo 146022717 > }}
### `youtube`
[Documentation of `youtube` ](https://gohugo.io/content-management/shortcodes/#youtube )
2020-03-19 05:35:37 +01:00
Example `youtube` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* youtube w7Ft2ymGmfc */>}}
```
The rendered output looks like this:
{{< youtube w7Ft2ymGmfc > }}
## LoveIt Shortcodes
**LoveIt** provides multiple shortcodes on top of existing ones.
### `style`
`style` is a shortcode to insert custom style in your post.
2020-03-19 05:35:37 +01:00
The `style` shortcode has two positional parameters.
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
The **first** one is the custom style content.
And the **second** one is the HTML tag around the content you want to change style, and whose default value is `p` .
Example `style` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* style "text-align: right" */>}}
This is a right-aligned paragraph.
{{< /* /style */>}}
```
The rendered output looks like this:
{{< style " text-align: right " > } }
This is a right-aligned paragraph.
{{< / style > }}
2020-03-17 14:16:04 +01:00
### `link`
2020-03-17 17:52:36 +01:00
{{< version 0 . 2 . 0 > }}
2020-03-17 14:16:04 +01:00
`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.
2020-03-19 05:35:37 +01:00
The `link` shortcode has the following named parameters:
2020-03-17 14:16:04 +01:00
2020-03-19 05:35:37 +01:00
* **href** *[required]* (**first** positional parameter)
2020-03-17 14:16:04 +01:00
Destination of the link.
2020-03-19 05:35:37 +01:00
* **content** *[optional]* (**second** positional parameter)
2020-03-17 14:16:04 +01:00
2020-03-19 05:35:37 +01:00
Content of the link, default is the value of **href** parameter.
2020-03-17 14:16:04 +01:00
2020-03-19 05:35:37 +01:00
*Markdown or HTML format is supported.*
2020-03-17 14:16:04 +01:00
2020-03-19 05:35:37 +01:00
* **title** *[optional]* (**third** positional parameter)
2020-03-17 14:16:04 +01:00
2020-03-19 05:35:37 +01:00
`title` attribute of the HTML `a` tag, which will be shown when hovering on the link.
2020-03-17 14:16:04 +01:00
2020-03-19 05:35:37 +01:00
* **class** *[optional]*
2020-03-17 14:16:04 +01:00
`class` attribute of the HTML `a` tag.
2020-03-19 05:35:37 +01:00
* **rel** *[optional]*
Additional `rel` attributes of the HTML `a` tag.
2020-03-17 14:16:04 +01:00
2020-03-19 05:35:37 +01:00
Example `link` input:
2020-03-17 14:16:04 +01:00
```markdown
{{< /* link "https://assemble.io" */>}}
Or
{{< /* link href="https://assemble.io" */>}}
{{< /* link "mailto:contact@revolunet.com" */>}}
Or
{{< /* link href="mailto:contact@revolunet.com" */>}}
{{< /* link "https://assemble.io" Assemble */>}}
Or
{{< /* link href="https://assemble.io" content=Assemble */>}}
```
The rendered output looks like this:
* {{< link " https: // assemble . io " > }}
* {{< link " mailto:contact @ revolunet . com " > }}
* {{< link " https: // assemble . io " Assemble > }}
2020-03-19 05:35:37 +01:00
Example `link` input with a title:
2020-03-17 14:16:04 +01:00
```markdown
{{< /* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
Or
{{< /* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
```
The rendered output looks like this (hover over the link, there should be a tooltip):
{{< link " https: / / github . com / upstage / " Upstage " Visit Upstage ! " > }}
2020-03-08 14:02:21 +01:00
### `image`
2020-03-19 09:54:47 +01:00
{{< version 0 . 2 . 0 changed > }}
2020-03-08 14:02:21 +01:00
`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 ).
2020-03-19 05:35:37 +01:00
The `image` shortcode has the following named parameters:
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
* **src** *[required]* (**first** positional parameter)
2020-03-08 14:02:21 +01:00
URL of the image to be displayed.
2020-03-19 05:35:37 +01:00
* **alt** *[optional]* (**second** positional parameter)
Alternate text for the image if the image cannot be displayed, default is the value of **src** parameter.
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
*Markdown or HTML format is supported.*
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
* **caption** *[optional]* (**third** positional parameter)
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
Image caption.
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
*Markdown or HTML format is supported.*
* **title** *[optional]*
Image title that will be shown when hovering on the image.
* **class** *[optional]*
2020-03-08 14:02:21 +01:00
`class` attribute of the HTML `figure` tag.
2020-03-19 05:35:37 +01:00
* **src_s** *[optional]*
URL of the image thumbnail, used for lightgallery, default is the value of **src** parameter.
* **src_l** *[optional]*
URL of the HD image, used for lightgallery, default is the value of **src** parameter.
* **height** *[optional]*
`height` attribute of the image.
* **width** *[optional]*
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
`width` attribute of the image.
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
* **linked** *[optional]*
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
Whether the image needs to be hyperlinked, default is `true` .
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
* **rel** *[optional]*
Additional `rel` attributes of the HTML `a` tag, if **linked** parameter is set to `true` .
* **large** *[optional]*
Whether the image is large used for loading animation, if **linked** parameter is set to `false` .
Example `image` input:
2020-03-08 14:02:21 +01:00
```markdown
2020-03-19 05:35:37 +01:00
{{< /* image src="/images/theme-documentation-shortcodes/lighthouse.jpg" caption="Lighthouse (`image`)" src-s="/images/theme-documentation-shortcodes/lighthouse-small.jpg" src-l="/images/theme-documentation-shortcodes/lighthouse-large.jpg" */>}}
2020-03-08 14:02:21 +01:00
```
The rendered output looks like this:
2020-03-19 05:35:37 +01:00
{{< image src = "/images/theme-documentation-shortcodes/lighthouse.jpg" caption = "Lighthouse (`image`)" src-s = "/images/theme-documentation-shortcodes/lighthouse-small.jpg" src-l = "/images/theme-documentation-shortcodes/lighthouse-large.jpg" > }}
2020-03-08 14:02:21 +01:00
### `admonition`
2020-03-19 05:35:37 +01:00
The `admonition` shortcode supports **12** types of banners to help you put notice in your page.
*Markdown or HTML format in the content is supported.*
2020-03-08 14:02:21 +01:00
{{< admonition > }}
A **note** banner
{{< / admonition > }}
{{< admonition abstract > }}
An **abstract** banner
{{< / admonition > }}
{{< admonition info > }}
A **info** banner
{{< / admonition > }}
{{< admonition tip > }}
A **tip** banner
{{< / admonition > }}
{{< admonition success > }}
A **success** banner
{{< / admonition > }}
{{< admonition question > }}
A **question** banner
{{< / admonition > }}
{{< admonition warning > }}
A **warning** banner
{{< / admonition > }}
{{< admonition failure > }}
A **failure** banner
{{< / admonition > }}
{{< admonition danger > }}
A **danger** banner
{{< / admonition > }}
{{< admonition bug > }}
A **bug** banner
{{< / admonition > }}
{{< admonition example > }}
An **example** banner
{{< / admonition > }}
{{< admonition quote > }}
A **quote** banner
{{< / admonition > }}
2020-03-19 05:35:37 +01:00
The `admonition` shortcode has the following named parameters:
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
* **type** *[optional]* (**first** positional parameter)
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
Type of the `admonition` banner, default is `note` .
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
* **title** *[optional]* (**second** positional parameter)
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
Title of the `admonition` banner, default is the value of **type** parameter.
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
* **details** *[optional]* (**third** positional parameter)
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
Whether the content will be expandable/collapsible, default is `false` .
2020-03-08 14:02:21 +01:00
2020-03-19 05:35:37 +01:00
Example `admonition` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* admonition type=tip title="This is a tip" details=true */>}}
A **tip** banner
{{< /* /admonition */>}}
Or
{{< /* admonition tip "This is a tip" true */>}}
A **tip** banner
{{< /* /admonition */>}}
```
The rendered output looks like this:
{{< admonition tip " This is a tip " true > }}
A **tip** banner
{{< / admonition > }}
### `mermaid`
[mermaid ](https://mermaidjs.github.io/ ) is a library helping you to generate diagram and flowcharts from text, in a similar manner as Markdown.
Just insert your mermaid code in the `mermaid` shortcode and that’ s it.
#### Flowchart {#flowchart}
2020-03-19 05:35:37 +01:00
Example **flowchart** `mermaid` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* mermaid */>}}
graph LR;
A[Hard edge] -->|Link text| B(Round edge)
B --> C{Decision}
C -->|One| D[Result one]
C -->|Two| E[Result two]
{{< /* /mermaid */>}}
```
The rendered output looks like this:
{{< mermaid > }}
graph LR;
A[Hard edge] -->|Link text| B(Round edge)
B --> C{Decision}
C -->|One| D[Result one]
C -->|Two| E[Result two]
{{< / mermaid > }}
#### Sequence Diagram {#sequence-diagram}
2020-03-19 05:35:37 +01:00
Example **sequence diagram** `mermaid` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* 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!
{{< /* /mermaid */>}}
```
The rendered output looks like this:
{{< 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!
{{< / mermaid > }}
#### GANTT {#gantt}
2020-03-19 05:35:37 +01:00
Example **GANTT** `mermaid` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* mermaid */>}}
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram functionality to mermaid
section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d
section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison :crit, done, after des1, 2d
Create tests for parser :crit, active, 3d
Future task in critical line :crit, 5d
Create tests for renderer :2d
Add to mermaid :1d
{{< /* /mermaid */>}}
```
The rendered output looks like this:
{{< mermaid > }}
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram functionality to mermaid
section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d
section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison :crit, done, after des1, 2d
Create tests for parser :crit, active, 3d
Future task in critical line :crit, 5d
Create tests for renderer :2d
Add to mermaid :1d
{{< / mermaid > }}
#### Class Diagram {#class-diagram}
2020-03-19 05:35:37 +01:00
Example **class diagram** `mermaid` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* mermaid */>}}
classDiagram
Class01 < |-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 < -- > C2: Cool label
{{< /* /mermaid */>}}
```
The rendered output looks like this:
{{< mermaid > }}
classDiagram
Class01 < |-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 < -- > C2: Cool label
{{< / mermaid > }}
#### State Diagram {#state-diagram}
2020-03-19 05:35:37 +01:00
Example **state diagram** `mermaid` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* mermaid */>}}
stateDiagram
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
{{< /* /mermaid */>}}
```
The rendered output looks like this:
{{< mermaid > }}
stateDiagram
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
{{< / mermaid > }}
#### Git Graph {#git-graph}
2020-03-19 05:35:37 +01:00
Example **git graph** `mermaid` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* mermaid */>}}
gitGraph:
options
{
"nodeSpacing": 100,
"nodeRadius": 10
}
end
commit
branch newbranch
checkout newbranch
commit
commit
checkout master
commit
commit
merge newbranch
{{< /* /mermaid */>}}
```
The rendered output looks like this:
{{< mermaid > }}
gitGraph:
options
{
"nodeSpacing": 100,
"nodeRadius": 10
}
end
commit
branch newbranch
checkout newbranch
commit
commit
checkout master
commit
commit
merge newbranch
{{< / mermaid > }}
#### Pie {#pie}
2020-03-19 05:35:37 +01:00
Example **pie** `mermaid` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* mermaid */>}}
pie
"Dogs" : 386
"Cats" : 85
"Rats" : 15
{{< /* /mermaid */>}}
```
The rendered output looks like this:
{{< mermaid > }}
pie
"Dogs" : 386
"Cats" : 85
"Rats" : 15
{{< / mermaid > }}
### `echarts`
[ECharts ](https://echarts.apache.org/ ) 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 that’ s it.
2020-03-19 05:35:37 +01:00
Example `echarts` input in `JSON` format:
2020-03-08 14:02:21 +01:00
```json
2020-03-10 07:57:39 +01:00
{{< /* echarts */>}}
2020-03-08 14:02:21 +01:00
{
"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 > }}
### `music`
The `music` shortcode embeds a responsive music player based on [APlayer ](https://github.com/MoePlayer/APlayer ) and [MetingJS ](https://github.com/metowolf/MetingJS ).
2020-03-19 05:35:37 +01:00
There are three ways to use it the `music` shortcode.
2020-03-08 14:02:21 +01:00
#### Custom Music URL {#custom-music-url}
2020-03-19 05:35:37 +01:00
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:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* music url="https://rainymood.com/audio1110/0.m4a" name=rainymood artist=rainymood cover="https://rainymood.com/i/badge.jpg" */>}}
```
The rendered output looks like this:
{{< music url = "https://rainymood.com/audio1110/0.m4a" name = rainymood artist = rainymood cover = "https://rainymood.com/i/badge.jpg" > }}
#### Music Platform URL Automatic Identification {#automatic-identification}
2020-03-19 05:35:37 +01:00
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:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* 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" > }}
#### Custom Server, Type and ID {#custom-server}
2020-03-19 05:35:37 +01:00
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:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* music server="netease" type="song" id="1868553" */>}}
Or
{{< /* music netease song 1868553 */>}}
```
The rendered output looks like this:
{{< music netease song 1868553 > }}
2020-03-19 05:35:37 +01:00
#### Other Parameters
The `music` shortcode has other named parameters applying to the above three ways:
* **theme** *[optional]*
Main color of the music player, default is `#a9a9b3` .
* **fixed** *[optional]*
Whether to enable fixed mode, default is `false` .
* **mini** *[optional]*
Whether to enable mini mode, default is `false` .
* **autoplay** *[optional]*
Whether to autoplay music, default is `false` .
* **volume** *[optional]*
Default volume when the player is first opened, which will be remembered in the browser, default is `0.7` .
* **mutex** *[optional]*
Whether to pause other players when this player starts playing, default 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 is `none` .
* **order** *[optional]*
[`list`, `random` ]
Play order of the music list, default is `list` .
* **list-folded** *[optional]*
Whether the music list should be folded at first, default is `false` .
* **list-max-height** *[optional]*
Max height of the music list, default is `340px` .
2020-03-08 14:02:21 +01:00
### `bilibili`
The `bilibili` shortcode embeds a responsive video player for bilibili videos.
When the video only has one part, only the `av` ID of the video is required, e.g.:
```code
https://www.bilibili.com/video/av47027633
```
2020-03-19 05:35:37 +01:00
Example `bilibili` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* bilibili 47027633 */>}}
Or
{{< /* bilibili av=47027633 */>}}
```
The rendered output looks like this:
{{< bilibili av = 47027633 > }}
When the video has multiple parts, in addition to the `av` ID of the video,
`p` is also required, whose default value is `1` , e.g.:
```code
https://www.bilibili.com/video/av36570401?p=3
```
2020-03-19 05:35:37 +01:00
Example `bilibili` input with `p` :
2020-03-08 14:02:21 +01:00
```markdown
{{< /* bilibili 36570401 3 */>}}
Or
{{< /* bilibili av=36570401 p=3 */>}}
```
The rendered output looks like this:
{{< bilibili av = 36570401 p = 3 > }}
### `typeit`
The `typeit` shortcode provides typing animation based on [TypeIt ](https://typeitjs.com/ ).
Just insert your content in the `typeit` shortcode and that’ s it.
#### Simple Content {#simple-content}
Simple content is allowed in `Markdown` format and **without** rich block content such as images and more...
2020-03-19 05:35:37 +01:00
Example `typeit` input:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* 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** .
2020-03-19 05:35:37 +01:00
Example `typeit` input with `h4` tag:
2020-03-08 14:02:21 +01:00
```markdown
{{< /* 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 > }}
#### Code Content {#code-content}
Code content is allowed and will be highlighted by named parameter `code` for the type of code language.
2020-03-19 05:35:37 +01:00
Example `typeit` input with `code` :
2020-03-08 14:02:21 +01:00
```markdown
{{< /* 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 > }}
#### 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.
2020-03-19 05:35:37 +01:00
Example `typeit` input with `group` :
2020-03-08 14:02:21 +01:00
```markdown
{{< /* 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 > }}