code-toggle
shortcode 根據任意支持的配寘程式碼,生成多種格式等效的程式碼塊。
格式§
支持 JSON
、TOML
和 YAML
格式。
用法§
1{{< code-toggle >}}
2CODE IN ANY SUPPORTED FORMAT
3{{</ code-toggle >}}
帶有文件名:
1{{< filename="config" code-toggle >}}
2CODE IN ANY SUPPORTED FORMAT
3{{</ code-toggle >}}
例子§
1{{< code-toggle filename="params" >}}
2{
3 "logo": "/images/logo.png",
4 "customCSS": ["foo.css", "bar.css"],
5 "codeBlock": {
6 "maxLines": 10
7 }
8}
9{{</ code-toggle >}}
params.toml
1customCSS = ['foo.css', 'bar.css']
2logo = '/images/logo.png'
3[codeBlock]
4 maxLines = 10
params.yaml
1codeBlock:
2 maxLines: 10
3customCSS:
4- foo.css
5- bar.css
6logo: /images/logo.png
params.json
1{
2 "codeBlock": {
3 "maxLines": 10
4 },
5 "customCSS": [
6 "foo.css",
7 "bar.css"
8 ],
9 "logo": "/images/logo.png"
10}
评论