feat(shortcodes): add admonition shortcode (#285)

This commit is contained in:
welpo 2024-03-21 01:21:11 +01:00
parent edef96567c
commit d0162291d9
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6
6 changed files with 297 additions and 3 deletions

View file

@ -1,7 +1,7 @@
+++
title = "Custom shortcodes"
date = 2023-02-19
updated = 2024-02-16
updated = 2024-03-20
description = "This theme includes some useful custom shortcodes that you can use to enhance your posts. Whether you want to display images that adapt to light and dark themes, or format a professional-looking reference section, these custom shortcodes have got you covered."
[taxonomies]
@ -97,6 +97,30 @@ All other image shortcodes can be made into full-width by setting the optional p
## Text shortcodes
### Admonitions
Bring attention to information with these admonition shortcodes. They come in five `type`s: `note`, `tip`, `info`, `warning`, and `danger`.
{{ admonition(type="note", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }}
{{ admonition(type="tip", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }}
{{ admonition(type="info", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }}
{{ admonition(type="warning", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }}
{{ admonition(type="danger", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }}
You can set a custom title with the `title` parameter:
{{ admonition(type="note", title="Custom title", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }}
#### Usage
```
{{/* admonition(type="info", title="Optional custom title", text="Something.") */}}
```
### Multilingual quotes
This shortcode allows you to display both the translated and original text for a quote. The quotation marks will be added automatically: