hugo-theme-hilfe/layouts/shortcodes/hint.html
Robert Kaussow f6966b8513
feat: add optional hint/admonition icons (#383)
BREAKING CHANGE: The types of the `hint` short code have been renamed to `[note|tip|important|caution|warning]` the old types `[info|ok|warning|danger]` are still working, but should be considered as deprecated.

BREAKING CHANGE: The `hint` short code is using named arguments now. You have to change, e.g. `{{< hint warning >}}` to `{{< hint type=warning >}}`.
2022-04-23 15:14:42 +02:00

17 lines
550 B
HTML

{{ $type := default "note" (.Get "type") }}
{{ $icon := .Get "icon" }}
{{ $title := default ($type | title) (.Get "title") }}
<blockquote class="gdoc-hint {{ $type | lower }}">
<div class="gdoc-hint__title flex align-center">
{{ with $icon }}
<svg class="gdoc-icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg>
<span>{{ $title }}</span>
{{ else }}
<i class="fa {{ $type | lower }}" title="{{ $title }}"></i>
{{ end }}
</div>
<div class="gdoc-hint__text">{{ .Inner | $.Page.RenderString }}</div>
</blockquote>