The code-toggle shortcode generates code blocks of various formats according to the configuration code of any supported format.

Formats#

JSON, TOML and YAML are supported.

Usage#

{{< code-toggle >}}
CODE IN ANY SUPPORTED FORMAT
{{</ code-toggle >}}

With a filename:

{{< filename="config" code-toggle >}}
CODE IN ANY SUPPORTED FORMAT
{{</ code-toggle >}}

Example#

{{< code-toggle filename="params" >}}
{
    "logo": "/images/logo.png",
    "customCSS": ["foo.css", "bar.css"],
    "codeBlock": {
        "maxLines": 10
    }
}
{{</ code-toggle >}}
customCSS = ['foo.css', 'bar.css']
logo = '/images/logo.png'
[codeBlock]
  maxLines = 10
codeBlock:
  maxLines: 10
customCSS:
- foo.css
- bar.css
logo: /images/logo.png
{
   "codeBlock": {
      "maxLines": 10
   },
   "customCSS": [
      "foo.css",
      "bar.css"
   ],
   "logo": "/images/logo.png"
}