Example

Example is an Eleventy shortcode. It does not require a Nunjucks import statement.

Inception alert! The example component is used in Kanga docs to show examples of components. It currently works with:

  • Markdown .md files
  • Nunjucks .njk files

The component will render the example in an iFrame at the specified height and extract the code into a details.

Open this example in a new tab
View the code for this example
{% example '/kanga/example/components/example-example', '180' %}

Shortcode arguments

Call the shortcode like so:

{% example file, height %}
Argument Type Description
file string Required. The file that contains the example code. Don’t use the file extension; this will be auto-detected. Supports .md or .njk
height string The height of the iFrame. Defaults to 300.