Le thème **LoveIt** fournit plusieurs shortcodes en plus de ceux intégrés dans Hugo.
<!--more-->
{{<admonitionwarning>}}
Sorry, this article has not been completely translated into **French**.
Welcome to take the time to propose a translation by [making a PR](https://github.com/dillonzq/LoveIt/pulls) to the theme!
{{</admonition>}}
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)
[Documentation of `highlight`](https://gohugo.io/content-management/shortcodes/#instagram)
Example `highlight` Input:
```markdown
{{</* highlight html */>}}
<sectionid="main">
<div>
<h1id="title">{{ .Title }}</h1>
{{ range .Pages }}
{{ .Render "summary"}}
{{ end }}
</div>
</section>
{{</* /highlight */>}}
```
The rendered output looks like this:
{{<highlighthtml>}}
<sectionid="main">
<div>
<h1id="title">{{ .Title }}</h1>
{{ range .Pages }}
{{ .Render "summary"}}
{{ end }}
</div>
</section>
{{</highlight>}}
### `instagram`
[Documentation of `instagram`](https://gohugo.io/content-management/shortcodes/#instagram)
Example `instagram` Input:
```markdown
{{</* instagram BWNjjyYFxVx hidecaption */>}}
```
The rendered output looks like this:
{{<instagramBWNjjyYFxVxhidecaption>}}
### `param`
[Documentation of `param`](https://gohugo.io/content-management/shortcodes/#param)
Example `param` Input:
```markdown
{{</* param description */>}}
```
The rendered output looks like this:
{{<paramdescription>}}
### `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)
Example `tweet` Input:
```markdown
{{</* tweet 877500564405444608 */>}}
```
The rendered output looks like this:
{{<tweet877500564405444608>}}
### `vimeo`
[Documentation of `vimeo`](https://gohugo.io/content-management/shortcodes/#vimeo)
Example `vimeo` Input:
```markdown
{{</* vimeo 146022717 */>}}
```
The rendered output looks like this:
{{<vimeo146022717>}}
### `youtube`
[Documentation of `youtube`](https://gohugo.io/content-management/shortcodes/#youtube)
Example `youtube` Input:
```markdown
{{</* youtube w7Ft2ymGmfc */>}}
```
The rendered output looks like this:
{{<youtubew7Ft2ymGmfc>}}
## LoveIt Shortcodes
**LoveIt** provides multiple shortcodes on top of existing ones.
### `style`
`style` is a shortcode to insert custom style in your post.
The `style` shortcode can use two parameters. The first is the custom style content and the second is the HTML tag around the content you want to change style, and whose default value is `p`.
`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.
The `link` shortcode can use the following named parameters:
* **href**
Destination of the link.
* **content**
Content of the link (HTML format is allowed).
* **title**
`title` attribute of the HTML `a` tag, which will be shown when hovering on the link.
* **rel**
Additional `rel` attributes of the HTML `a` tag.
* **class**
`class` attribute of the HTML `a` tag.
#### Basic `link`
Example basic `link` Input:
```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>}}
#### Add a Title
```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):
`image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js).
The `image` shortcode can use the following named parameters:
* **src**
URL of the image to be displayed.
* **description**
Image description.
* **title**
Image title.
* **class**
`class` attribute of the HTML `figure` tag.
* **src_s**
URL of the image thumbnail, used for lightgallery.
The `admonition` shortcode supports **12** types of banners to help you put notice in your page and `Markdown` format is supported.
{{<admonition>}}
A **note** banner
{{</admonition>}}
{{<admonitionabstract>}}
An **abstract** banner
{{</admonition>}}
{{<admonitioninfo>}}
A **info** banner
{{</admonition>}}
{{<admonitiontip>}}
A **tip** banner
{{</admonition>}}
{{<admonitionsuccess>}}
A **success** banner
{{</admonition>}}
{{<admonitionquestion>}}
A **question** banner
{{</admonition>}}
{{<admonitionwarning>}}
A **warning** banner
{{</admonition>}}
{{<admonitionfailure>}}
A **failure** banner
{{</admonition>}}
{{<admonitiondanger>}}
A **danger** banner
{{</admonition>}}
{{<admonitionbug>}}
A **bug** banner
{{</admonition>}}
{{<admonitionexample>}}
An **example** banner
{{</admonition>}}
{{<admonitionquote>}}
A **quote** banner
{{</admonition>}}
The `admonition` shortcode can use the following named parameters:
* **type**
Type of the `admonition` banner, default is **note**
* **title**
Title of the `admonition` banner, default is the type name of the banner
* **details**
if `true`, the content will be expandable/collapsible.
You can also use the positional parameters in the order of **type**, **title** and **details**.
Example `admonition` Input:
```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:
{{<admonitiontip"Thisisatip"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}
Example **flowchart**`mermaid` Input:
```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}
Example **sequence diagram**`mermaid` Input:
```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}
Example **GANTT**`mermaid` Input:
```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}
Example **class diagram**`mermaid` Input:
```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}
Example **state diagram**`mermaid` Input:
```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}
Example **git graph**`mermaid` Input:
```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}
Example **pie**`mermaid` Input:
```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.
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 can use the following named parameters: