-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add optional hint/admonition icons (#233)
- Loading branch information
Showing
25 changed files
with
339 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,4 @@ Theming | |
Favicon[s]? | ||
webpack | ||
pre-processor[s]? | ||
Asciidoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
+++ | ||
title = "Admonition Icons" | ||
date = 2020-06-22T20:00:00+02:00 | ||
+++ | ||
|
||
:icons: font | ||
|
||
By default, the admonition is rendered with a plain text label. To enable font icons the document attribute `:icons: font` need to be set. | ||
|
||
== Example | ||
|
||
[NOTE] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
[TIP] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
[IMPORTANT] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
[CAUTION] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
[WARNING] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
+++ | ||
title = "Admonitions" | ||
date = 2020-06-22T20:00:00+02:00 | ||
+++ | ||
|
||
:toc: | ||
:toclevels: 2 | ||
|
||
{{< toc >}} | ||
|
||
== Admonition types | ||
|
||
There are certain statements you may want to draw attention to by taking them out of the content's flow and labeling them with a priority. These are called admonitions. | ||
|
||
```tpl | ||
[NOTE|TIP|IMPORTANT|CAUTION|WARNING] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
``` | ||
|
||
=== Example | ||
|
||
[NOTE] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
[TIP] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
[IMPORTANT] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
[CAUTION] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
[WARNING] | ||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. | ||
Ornateness bland it ex enc, est yeti am bongo detract re. | ||
|
||
|
||
== Admonition icons | ||
|
||
Icons can be added by setting a unicode glyph or a character reference to the `tip-caption` attribute: | ||
|
||
```text | ||
:tip-caption: 💡 | ||
|
||
[TIP] | ||
It's possible to use Unicode glyphs as admonition icons. | ||
``` | ||
|
||
```text | ||
:tip-caption: pass:[🔥] | ||
|
||
[TIP] | ||
It's possible to use Unicode glyphs as admonition icons. | ||
``` | ||
|
||
=== Example | ||
|
||
:tip-caption: 💡 | ||
|
||
[TIP] | ||
It's possible to use Unicode glyphs as admonition icons. | ||
|
||
|
||
:tip-caption: pass:[🔥] | ||
|
||
[TIP] | ||
It's possible to use Unicode glyphs as admonition icons. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
<blockquote class="gblog-hint {{ .Get 0 }}"> | ||
{{ .Inner | $.Page.RenderString }} | ||
{{ $type := default "note" (.Get "type") }} | ||
{{ $icon := .Get "icon" }} | ||
{{ $title := default ($type | title) (.Get "title") }} | ||
|
||
|
||
<blockquote class="gblog-hint {{ $type | lower }}"> | ||
<div class="gblog-hint__title flex align-center"> | ||
{{- with $icon -}} | ||
<svg class="gblog-icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg> | ||
<span>{{ $title }}</span> | ||
{{- else -}} | ||
<i class="fa {{ $type | lower }}" title="{{ $title }}"></i> | ||
{{- end -}} | ||
</div> | ||
<div class="gblog-hint__text">{{ .Inner | $.Page.RenderString }}</div> | ||
</blockquote> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
.admonitionblock { | ||
@each $name, $color in $hint-colors { | ||
&.#{$name} { | ||
border-left-color: $color; | ||
background-color: scale-color($color, $lightness: 95%, $saturation: -30%); | ||
color: $body-font-color; | ||
} | ||
} | ||
|
||
margin: $padding-16 0; | ||
padding: 0; | ||
|
||
border-left: $border-4 solid var(--accent-color); | ||
border-radius: $border-radius; | ||
|
||
table { | ||
margin: 0 !important; | ||
padding: 0 !important; | ||
|
||
tr { | ||
border: 0 !important; | ||
} | ||
|
||
td { | ||
&:first-child { | ||
background-color: scale-color($gray-600, $alpha: -95%); | ||
font-weight: bold; | ||
|
||
&.icon { | ||
.title { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
i.fa::after { | ||
content: attr(title); | ||
font-style: normal; | ||
padding-left: $padding-24; | ||
} | ||
|
||
i.fa { | ||
color: $black; | ||
background-size: auto 90%; | ||
background-repeat: no-repeat; | ||
filter: invert(30%); | ||
margin-left: -5px; | ||
} | ||
|
||
@each $name, $icon in $hint-icons { | ||
i.fa.icon-#{$name} { | ||
background-image: url(img/geekdoc-stack.svg##{$icon}); | ||
} | ||
} | ||
} | ||
} | ||
|
||
display: flex; | ||
padding: $padding-4 $padding-16 !important; | ||
} | ||
} | ||
} |
Oops, something went wrong.