One block, one price.
Built-in blocks
dj-spellbook ships three blocks. Adding "dj_spellbook" to INSTALLED_APPS makes them available in every document.
| Block | Arguments | Renders |
|---|---|---|
alert | type: info (the default), warning, success or danger | <aside> |
card | title, footer, each printed only when given | <article> |
accordion | title, and the flag open to start it open | <details> |
Each example below is the source, then the HTML dj-spellbook 0.1.0 rendered from it, styled by the package's own stylesheet.
alert
A callout, with no icon. With no type, an alert is info.
{~ alert ~}
With no `type`, an alert is `info`.
{~~}
{~ alert type="warning" ~}
Take a backup **first**.
{~~}
{~ alert type="success" ~}
The document passed the check.
{~~}
{~ alert type="danger" ~}
Never render a stranger's markdown with this.
{~~}
A type outside the four is refused:
{~ alert type="note" ~}
Note is not a type.
{~~}
line 1: `alert`: type `note` is not one of info, warning, success, danger
card
A card with a title header and a footer, each printed only when given. Here with a class and an id as well:
{~ card title="Pricing" footer="Billed monthly in CAD" .wide #pricing ~}
One block, one price.
{~~}
accordion
A <details> element under a title. The bare flag open starts it open:
{~ accordion title="Why a block?" open ~}
So the words and the markup stay apart.
{~~}
Why a block?
So the words and the markup stay apart.
Without the flag it starts closed:
{~ accordion title="Closed until opened" ~}
With no `open` flag, the accordion starts closed.
{~~}
Closed until opened
With no open flag, the accordion starts closed.
open="yes" is refused: open is a flag, written bare or left out.
Class names
The class names are stable, so your own CSS can hang off them:
spell-callout,spell-callout--info,spell-callout--warning,spell-callout--success,spell-callout--danger,spell-callout-bodyspell-card,spell-card-head,spell-card-body,spell-card-footspell-accordion,spell-accordion-summary,spell-accordion-body
An author's .class names are added after the built-in class, and #id becomes the element's id. Each built-in lists its arguments, so it refuses any other; a class and an id are always accepted.