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 >}}`.
This commit is contained in:
Robert Kaussow 2022-04-23 15:14:42 +02:00 committed by GitHub
parent 1563cd228b
commit f6966b8513
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 310 additions and 35 deletions

View file

@ -39,7 +39,7 @@
/>
<label
{{ if $doCollapse }}
for="{{ printf "navtree-%s" $id }}" class="flex justify-between"
for="{{ printf "navtree-%s" $id }}" class="flex justify-between align-center"
{{ end }}
>
<span class="flex">

View file

@ -40,7 +40,6 @@
{{ range $rangeBy }}
{{ if not .Params.GeekdocHidden }}
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
{{ $isParent := and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }}
{{ $isCurrent := eq $current . }}
@ -61,7 +60,7 @@
/>
<label
{{ if $doCollapse }}
for="{{ printf "navtree-%s" $id }}" class="flex justify-between"
for="{{ printf "navtree-%s" $id }}" class="flex justify-between align-center"
{{ end }}
>
{{ if or .Content .Params.GeekdocFlatSection }}

View file

@ -1,5 +1,5 @@
{{ if default true .Site.Params.GeekdocSearch }}
<div class="gdoc-search">
<div class="gdoc-search flex align-center">
<svg class="gdoc-icon gdoc_search"><use xlink:href="#gdoc_search"></use></svg>
<input
type="text"

View file

@ -1,3 +1,16 @@
<blockquote class="gdoc-hint {{ .Get 0 }}">
{{ .Inner | $.Page.RenderString }}
{{ $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>