Components

/ #guide
ABSTRACT

Use Nivis image and collapsible-content components in Markdown posts.

CONTENTS

Nivis includes two Tera components: image for responsive images and captions, and collapse for Markdown content that can be opened and closed.

Image

The image component resolves src through Zola's get_url, so paths normally refer to files below the site's static/ directory.

ParameterRequiredDefaultPurpose
srcYes-Static asset path passed to get_url.
altNoEmptyAlternative text for the image.
captionNoEmptyAdds a figure and visible caption when non-empty.
classNoEmptyClass applied to the figure, or to the image when there is no caption.

Template:

{{<image src="images/example.jpg" alt="A precise description" caption="Optional caption" class="wide-image"/>}}

For example, the following source loads static/images/screenshot.png:

{{<image src="images/screenshot.png" alt="Nivis example site" caption="Nivis example site"/>}}

Rendered result:

Nivis example site
Nivis example site

Always provide useful alternative text for informative images. Leave alt empty only when an image is purely decorative.

Collapse

The collapse component renders a native details element and parses its body as Markdown.

ParameterRequiredDefaultPurpose
summaryNoDetailsVisible label for the disclosure control.
unfoldNofalseStarts the block open when set to true.

Closed by default:

{% <collapse summary="Derivation"> %}
This paragraph is hidden initially.

- Markdown lists work here.
- So do **emphasis**, links, and code blocks.
{% </collapse> %}

Rendered result:

Derivation

This paragraph is hidden initially.

  • Markdown lists work here.
  • So do emphasis, links, and code blocks.

Open by default:

{% <collapse summary="Shown initially" unfold={true}> %}
This content starts open but remains collapsible.
{% </collapse> %}

Rendered result:

Shown initially

This content starts open but remains collapsible.

Keep summaries short and descriptive. A collapse block should not hide content that every reader must see to understand the article.