#77, Introduce hint shortcode
This commit is contained in:
parent
3e3a3346e1
commit
1f8d34168f
10 changed files with 113 additions and 40 deletions
34
README.md
34
README.md
|
@ -141,7 +141,7 @@ BookMenuBundle = '/menu'
|
||||||
BookSection = 'docs'
|
BookSection = 'docs'
|
||||||
|
|
||||||
# (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode
|
# (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode
|
||||||
# BookMenuBundleActiveLinkColor = '\#004ed0'
|
# BookMenuBundleActiveLinkColor = '\#05b'
|
||||||
|
|
||||||
# Set source repository location.
|
# Set source repository location.
|
||||||
# Used for 'Last Modified' and 'Edit this page' links.
|
# Used for 'Last Modified' and 'Edit this page' links.
|
||||||
|
@ -212,16 +212,28 @@ There are few hugo tempaltes inserted in `<head>`
|
||||||
|
|
||||||
## Shortcodes
|
## Shortcodes
|
||||||
|
|
||||||
### Expand
|
### Hint
|
||||||
|
|
||||||
Provides clickable panel that show extra hidden content.
|
Hint shortcode can be used as hint/alerts/notification block. There are 3 colors to choose: `info`, `warning` and `danger`.
|
||||||
|
|
||||||
|
```tpl
|
||||||
|
{{< hint [info|warning|danger] >}}
|
||||||
|
**Markdown content**
|
||||||
|
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
||||||
|
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
||||||
|
{{< /hint >}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Buttons
|
||||||
|
|
||||||
|
Buttons are styled links to internal of external pages
|
||||||
|
|
||||||
```
|
```
|
||||||
{{< expand >}}
|
{{< button relref="/" >}}Get Home{{< /button >}}
|
||||||
## Markdown content
|
{{< button href="https://github.com/alex-shpak/hugo-book" >}}Contribute{{< /button >}}
|
||||||
{{< /expand >}}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Tabs
|
### Tabs
|
||||||
|
|
||||||
Useful if you want to show alternative information per platform or setting.
|
Useful if you want to show alternative information per platform or setting.
|
||||||
|
@ -251,6 +263,16 @@ Organize text in 2 or more columns to use space efficiently.
|
||||||
# Right Content Lorem markdownum insigne... {{< /columns >}}
|
# Right Content Lorem markdownum insigne... {{< /columns >}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Expand
|
||||||
|
|
||||||
|
Provides clickable panel that show extra hidden content.
|
||||||
|
|
||||||
|
```
|
||||||
|
{{< expand >}}
|
||||||
|
## Markdown content
|
||||||
|
{{< /expand >}}
|
||||||
|
```
|
||||||
|
|
||||||
### Mermaid Charts
|
### Mermaid Charts
|
||||||
|
|
||||||
Render various charts with [mermaidjs](https://mermaidjs.github.io/)
|
Render various charts with [mermaidjs](https://mermaidjs.github.io/)
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
margin: $padding-16 0;
|
margin: $padding-16 0;
|
||||||
padding: $padding-4 ($padding-16 - $padding-4); //to keep total left space 16dp
|
padding: $padding-8 $padding-16 $padding-8 ($padding-16 - $padding-4); //to keep total left space 16dp
|
||||||
|
|
||||||
border-left: $padding-4 solid $gray-200;
|
border-left: $padding-4 solid $gray-200;
|
||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
|
|
|
@ -97,3 +97,14 @@ a.book-btn {
|
||||||
margin-bottom: $padding-8;
|
margin-bottom: $padding-8;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// {{< hint >}}
|
||||||
|
.book-hint {
|
||||||
|
@each $name, $color in $hint-colors {
|
||||||
|
&.#{$name} {
|
||||||
|
border-left-color: $color;
|
||||||
|
background-color: rgba($color, 0.1);
|
||||||
|
// background-color: $gray-100;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ $gray-800: #343a40 !default;
|
||||||
$gray-900: #212529 !default;
|
$gray-900: #212529 !default;
|
||||||
$black: #000 !default;
|
$black: #000 !default;
|
||||||
|
|
||||||
$color-link: #004ed0 !default;
|
$color-link: #05b !default;
|
||||||
$color-visited-link: #8440f1 !default;
|
$color-visited-link: #8440f1 !default;
|
||||||
$color-dark-link: $gray-800 !default;
|
$color-dark-link: $gray-800 !default;
|
||||||
|
|
||||||
|
@ -41,3 +41,10 @@ $toc-width: 16rem !default;
|
||||||
|
|
||||||
$md-breakpoint: $menu-width + $body-min-width * 1.25 + $toc-width !default;
|
$md-breakpoint: $menu-width + $body-min-width * 1.25 + $toc-width !default;
|
||||||
$sm-breakpoint: $menu-width + $body-min-width !default;
|
$sm-breakpoint: $menu-width + $body-min-width !default;
|
||||||
|
|
||||||
|
// Panel colors
|
||||||
|
$hint-colors: (
|
||||||
|
info: #6bf,
|
||||||
|
warning: #fd6,
|
||||||
|
danger: #f66
|
||||||
|
);
|
||||||
|
|
|
@ -33,7 +33,7 @@ pygmentsCodeFences = true
|
||||||
BookSection = 'docs'
|
BookSection = 'docs'
|
||||||
|
|
||||||
# (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode
|
# (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode
|
||||||
# BookMenuBundleActiveLinkColor = '\#004ed0'
|
# BookMenuBundleActiveLinkColor = '\#05b'
|
||||||
|
|
||||||
# Set source repository location.
|
# Set source repository location.
|
||||||
# Used for 'Last Modified' and 'Edit this page' links.
|
# Used for 'Last Modified' and 'Edit this page' links.
|
||||||
|
|
|
@ -33,7 +33,7 @@ params:
|
||||||
BookSection: docs
|
BookSection: docs
|
||||||
|
|
||||||
# (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode
|
# (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode
|
||||||
# BookMenuBundleActiveLinkColor: "\#004ed0"
|
# BookMenuBundleActiveLinkColor: "\#05b"
|
||||||
|
|
||||||
# Set source repository location.
|
# Set source repository location.
|
||||||
# Used for 'Last Modified' and 'Edit this page' links.
|
# Used for 'Last Modified' and 'Edit this page' links.
|
||||||
|
|
|
@ -4,38 +4,34 @@ weight: 3
|
||||||
|
|
||||||
# Shortcodes
|
# Shortcodes
|
||||||
|
|
||||||
## Expand shortcode
|
## Hints
|
||||||
|
|
||||||
### Default
|
|
||||||
|
|
||||||
|
Hint shortcode can be used as hint/alerts/notification block. There are 3 colors to choose: `info`, `warning` and `danger`.
|
||||||
```tpl
|
```tpl
|
||||||
{{</* expand */>}}
|
{{</* hint [info|warning|danger] */>}}
|
||||||
## Markdown content
|
**Markdown content**
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{</* /expand */>}}
|
|
||||||
```
|
|
||||||
|
|
||||||
{{< expand >}}
|
|
||||||
## Markdown content
|
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{< /expand >}}
|
|
||||||
|
|
||||||
### With Custom Label
|
|
||||||
|
|
||||||
```tpl
|
|
||||||
{{</* expand "Custom Label" "..." */>}}
|
|
||||||
## Markdown content
|
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{</* /expand */>}}
|
|
||||||
```
|
|
||||||
|
|
||||||
{{< expand "Custom Label" "..." >}}
|
|
||||||
## Markdown content
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
{{</* /hint */>}}
|
||||||
Miseratus fonte Ditis conubia.
|
```
|
||||||
{{< /expand >}}
|
|
||||||
|
{{< hint info >}}
|
||||||
|
**Markdown content**
|
||||||
|
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
||||||
|
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
{{< hint warning >}}
|
||||||
|
**Markdown content**
|
||||||
|
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
||||||
|
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
|
{{< hint danger >}}
|
||||||
|
**Markdown content**
|
||||||
|
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
||||||
|
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
||||||
|
{{< /hint >}}
|
||||||
|
|
||||||
## Buttons
|
## Buttons
|
||||||
|
|
||||||
|
@ -135,6 +131,40 @@ protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
||||||
Miseratus fonte Ditis conubia.
|
Miseratus fonte Ditis conubia.
|
||||||
{{< /columns >}}
|
{{< /columns >}}
|
||||||
|
|
||||||
|
## Expand shortcode
|
||||||
|
|
||||||
|
Expand shortcode can help to decrease clutter on screen by hiding part of text
|
||||||
|
|
||||||
|
### Default
|
||||||
|
|
||||||
|
```tpl
|
||||||
|
{{</* expand */>}}
|
||||||
|
## Markdown content
|
||||||
|
Lorem markdownum insigne...
|
||||||
|
{{</* /expand */>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< expand >}}
|
||||||
|
## Markdown content
|
||||||
|
Lorem markdownum insigne...
|
||||||
|
{{< /expand >}}
|
||||||
|
|
||||||
|
### With Custom Label
|
||||||
|
|
||||||
|
```tpl
|
||||||
|
{{</* expand "Custom Label" "..." */>}}
|
||||||
|
## Markdown content
|
||||||
|
Lorem markdownum insigne...
|
||||||
|
{{</* /expand */>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< expand "Custom Label" "..." >}}
|
||||||
|
## Markdown content
|
||||||
|
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
||||||
|
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
||||||
|
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
||||||
|
Miseratus fonte Ditis conubia.
|
||||||
|
{{< /expand >}}
|
||||||
|
|
||||||
## Mermaid Chart
|
## Mermaid Chart
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
{"Target":"book.min.89885fa0429ec73067282f26fc0c6d38cfc617a443ec4e835d47b821c52c6e92.css","MediaType":"text/css","Data":{"Integrity":"sha256-iYhfoEKexzBnKC8m/AxtOM/GF6RD7E6DXUe4IcUsbpI="}}
|
{"Target":"book.min.e2750c58bf0545d36d2426996f9d6108a275d000f33e7552d83ea28bdcd34ab7.css","MediaType":"text/css","Data":{"Integrity":"sha256-4nUMWL8FRdNtJCaZb51hCKJ10ADzPnVS2D6ii9zTSrc="}}
|
3
layouts/shortcodes/hint.html
Normal file
3
layouts/shortcodes/hint.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<blockquote class="book-hint {{ .Get 0 }}">
|
||||||
|
{{ .Inner | markdownify }}
|
||||||
|
</blockquote>
|
Loading…
Reference in a new issue