Skip to main content
LFP Shortcode Library

Listing

Creates a semantically sound <figure> element with optional figcaption, and id to reference the element elsewhere. if hideCopy is set to "true", the default button to copy code to clipboard will not be displayed.

This component plays along nicely with Eleventy's own syntax highlighting plugin.

Argument Type Required
content[1] string yes
caption string no
id string no
hideCopy "true"|"false" no, default: "false"
lineNumbers "true"|"false" no, default: "false"

Usage

{% listing "Codeblock inside figure with caption." "listing-id-1" %}
```python
def codeblock():
    print("Hello World!")
```
{% endlisting %}

Example

def codeblock():
    print("Hello World!")
 Listing 1 : Codeblock inside figure with caption.
  1. With paired shortcodes, the first argument is the content placed inside the shortcode's delimiters. ↩︎