What's on this page
Add a table of contents and notes
Cecil extends Markdown with a few handy features for long pages: an automatic table of contents, note blocks and attributes on elements.
Insert a table of contents
Add the [toc] tag where the table of contents should appear in the body of the page:
[toc]
## Installation
### Requirements
## Usage
By default, the table of contents is built from H2 and H3 headings. Change it in cecil.yml:
pages:
body:
toc: [h2, h3, h4]
Display the table of contents in a template
To place the table of contents outside the content (e.g. in a sidebar), use the toc filter on the page body:
<aside>
{{ page.body|toc }}
</aside>
<article>
{{ page.content }}
</article>
The filter also accepts the headings to extract, e.g. {{ page.body|toc(selectors=['h2']) }}.
Add notes
Highlight information with a note block:
:::tip
**Tip:** This is advice.
:::
It is converted to:
<aside class="note note-tip">
<p>
<strong>Tip:</strong> This is advice.
</p>
</aside>
Available types are info, tip, important, warning and caution (or no type). Style them with the note and note-<type> CSS classes.
To nest notes, use a longer fence for the parent note (::::, then ::::: for a third level, etc.):
::::info
Before.
:::tip
**Tip:** This is advice.
:::
After.
::::
Cecil also provides note templates to structure content without JavaScript: tabs, code-group, steps, accordion and cards. Their items are defined with #### headings (or list entries for cards), and each type is rendered with the partials/notes/<type>.html.twig template, which you can override.
Add attributes
Set an id, a class or any attribute on a heading, a fenced code block, a link or an image, inside curly braces at the end of the line:
## Installation {#install .highlighted}
The #install id gives a stable anchor to link to: [See installation](#install).