Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating <hint> shortcode to be compatible with Hugo v0.100+ #153

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions content/docs/contributions/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,35 @@ We use the [Hugo Book Theme](https://themes.gohugo.io/hugo-book/) with custom mo
We modified the default [Hints](https://themes.gohugo.io/theme/hugo-book/docs/shortcodes/hints/) used by the theme; the modified boxes are listed below:

{{< hint info >}}
This is an *Info* box for the `{{</* hint info */>}}` shortcode.
This is an *Info* box for the `{{</*/* hint info */*/>}}` shortcode.
{{< /hint >}}

{{< hint note >}}
This is a *Note* box for the `{{</* hint note */>}}` shortcode.
This is a *Note* box for the `{{</*/* hint note */*/>}}` shortcode.
{{< /hint >}}

{{< hint example >}}
This is an *Example* box for the `{{</* hint example */>}}` shortcode.
This is an *Example* box for the `{{</*/* hint example */*/>}}` shortcode.
{{< /hint >}}

{{< hint tip >}}
This is a *Tip* box for the `{{</* hint tip */>}}` shortcode.
This is a *Tip* box for the `{{</*/* hint tip */*/>}}` shortcode.
{{< /hint >}}

{{< hint important >}}
This is an *Important* box for the `{{</* hint important */>}}` shortcode.
This is an *Important* box for the `{{</*/* hint important */*/>}}` shortcode.
{{< /hint >}}

{{< hint warning >}}
This is a *Warning* box for the `{{</* hint warning */>}}` shortcode.
This is a *Warning* box for the `{{</*/* hint warning */*/>}}` shortcode.
{{< /hint >}}

### Original style
The original hint style can be used by adding a third parameter, `noTitle`, to the shortcode, e.g.:

{{< hint example noTitle>}}

`{{</* hint example noTitle */>}}`
`{{</*/* hint example noTitle */*/>}}`

{{< /hint >}}

Expand Down
4 changes: 2 additions & 2 deletions themes/book/layouts/shortcodes/hint.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<svg class="book-icon">
<use href="/svg/hint-icons.svg#{{- $replaced -}}-notice"></use>
</svg><span>{{ $replaced }}</span></p>
{{ .Inner | markdownify }}
{{ replace (replace (trim .Inner "\r\n" | .Page.RenderString) "*/&gt;" "&gt;") "&lt;/*" "&lt;" | safeHTML }}
</blockquote>
{{ else }}
<blockquote class="book-hint {{ .Get 0 }}">
{{ .Inner | markdownify }}
{{ replace (replace (trim .Inner "\r\n" | .Page.RenderString) "*/&gt;" "&gt;") "&lt;/*" "&lt;" | safeHTML }}
</blockquote>
{{ end }}