Callouts
Lesson 3 of 3 — the last one of this module.
Some sentences must not be read as prose. A warning in the middle of a paragraph is a warning nobody reads.
The six kinds
note, info and alert complete the set. Without a type, a block is a
note; with a title, the label of the kind gives way to your words.
<Admonition type="danger" title="What a wrong move costs">
Deleting a version removes its pages from the site.
</Admonition>
Your turn: a kind of your own
Six kinds will not fit every team. Declare the one yours needs — a label, and a tone that carries the colour:
// docpensieve.config.mjs
admonitions: {
review: { label: 'To review', tone: 'attention' },
legal: { label: 'Legal notice', tone: 'info' },
},
<Admonition type="review">This section awaits a second pair of eyes.</Admonition>
The tone comes from the theme, so a new kind needs no stylesheet and follows the light and dark schemes on its own. A kind nobody declared stops the build, listing those that exist — rendered anyway, the block would come out with no colour and no label, and nothing would say why.
A mark of its own
A kind can carry an icon instead of the drawing of its tone. This very site declares two, with their marks taken from an icon set:
admonitions: {
copilot: { label: 'Copilot', tone: 'info', icon: 'simple-icons:githubcopilot' },
},
npm install --save-dev @iconify-json/simple-icons
The set is a package of your project, read when the site is built: the drawing is placed in the page like a file of your own. Your reader downloads nothing, and no request leaves their browser — which is also why a set you have not installed stops the build instead of leaving an empty square.
Check yourself
You wrote <Admonition type="warning">. What happens?
The build stops: warning is not one of the six, and nothing declared it. The
kinds are note, info, tip, attention, alert and danger — the one
you want here is attention.
Your reader has JavaScript turned off. What do they miss?
Nothing. The block is an aside written at the build, and its mark is an SVG
already in the page.
Well done
You have finished Making it yours. The site now carries your colours, your navigation and your warnings.
DocPensieve