Skip to content

Commit 4e6aad3

Browse files
authored
Merge pull request #1458 from gethinode/develop
FIx rendering of inner nav-item content
2 parents 559f7be + 8c3989e commit 4e6aad3

File tree

9 files changed

+26
-20
lines changed

9 files changed

+26
-20
lines changed

data/structures/nav-item.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
comment: >-
22
Defines an individual item.
33
arguments:
4+
page:
5+
group: partial
46
id:
57
group: partial
68
parent-id:

exampleSite/content/en/blog/bootstrap-elements.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ As an example, the following shortcode displays an accordion with three elements
3333
{{< example lang="hugo" >}}
3434
{{</* accordion */>}}
3535
{{</* accordion-item title="Accordion Item #1" show="true" */>}}
36-
This is the first item's accordion body. It supports HTML content, if enabled in the goldmark
37-
renderer. The item is shown by adding the value `show` to the `class` argument.
36+
This is the first item's accordion body.
37+
It supports Markdown content. The item
38+
is shown by adding the value `show` to the `class` argument.
3839
{{</* /accordion-item */>}}
3940
{{</* accordion-item title="Accordion Item #2" */>}}
4041
This is the second item's accordion body.
@@ -352,8 +353,8 @@ As an example, the following shortcode displays a tab group with vertically alig
352353
{{< example lang="hugo" >}}
353354
{{</* nav tab-type="pills" vertical="true" */>}}
354355
{{</* nav-item title="Nav Item #1" show="true" */>}}
355-
This is the first item's nav body. It supports HTML content, if enabled in the goldmark
356-
renderer. The item is shown by adding the value `show` to the `class` argument.
356+
This is the first item's nav body. It supports Markdown content.
357+
The item is shown by adding the value `show` to the `class` argument.
357358
{{</* /nav-item */>}}
358359
{{</* nav-item title="Nav Item #2" */>}}
359360
This is the second item's nav body.

exampleSite/hugo_stats.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,11 @@
603603
"fab-medium",
604604
"fab-whatsapp",
605605
"fab-x-twitter",
606-
"faq-422100b13f9388f5e5d9733a89582b72",
607-
"faq-422100b13f9388f5e5d9733a89582b72-heading-faq-422100b13f9388f5e5d9733a89582b72",
608-
"faq-422100b13f9388f5e5d9733a89582b72-item-0",
609-
"faq-422100b13f9388f5e5d9733a89582b72-item-1",
610-
"faq-422100b13f9388f5e5d9733a89582b72-item-2",
606+
"faq-d60f86697e8e822c14f81bde047a063e",
607+
"faq-d60f86697e8e822c14f81bde047a063e-heading-faq-d60f86697e8e822c14f81bde047a063e",
608+
"faq-d60f86697e8e822c14f81bde047a063e-item-0",
609+
"faq-d60f86697e8e822c14f81bde047a063e-item-1",
610+
"faq-d60f86697e8e822c14f81bde047a063e-item-2",
611611
"fas-1",
612612
"fas-2",
613613
"fas-3",

layouts/_partials/assets/nav-item.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ <h2 id="accordion-{{ $parentID }}-heading-{{ $args.id }}" class="accordion-heade
7272
aria-labelledby="{{ $parentID }}-heading-{{ $args.id }}"
7373
data-bs-parent="#accordion-{{ $parentID }}"
7474
>
75-
<div class="accordion-body">{{- $args.body | safeHTML -}}</div>
75+
<div class="accordion-body">{{ $args.body | $args.page.RenderString | safeHTML }}</div>
7676
</div>
7777
</div>
7878
{{ else }}
@@ -87,7 +87,7 @@ <h2 id="accordion-{{ $parentID }}-heading-{{ $args.id }}" class="accordion-heade
8787
data-has-content="{{ gt (len $args.body) 0 }}"
8888
{{ if $args.disabled }} data-disabled-id="{{ $args.id }}"{{ end }}
8989
>
90-
{{ $args.body }}
90+
{{ $args.body | $args.page.RenderString | safeHTML }}
9191
</div>
9292
{{ end }}
9393
{{ end }}

layouts/_partials/assets/nav.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
<div class="d-lg-none">
3434
<div id="accordion-{{ $id }}" class="accordion mb-3{{ with $args.class }} {{ . }}{{ end }} nav-callout">
3535
{{- range $index, $item := $args.list -}}
36-
{{ partial "assets/nav-item.html" (dict
36+
{{ partial "assets/nav-item.html" (dict
37+
"page" $args.page
3738
"id" $index
3839
"parentID" $id
3940
"fade" false

layouts/_shortcodes/nav-item.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@
3030
{{- if isset .Parent.Params "fade" }}{{ $parentFade = partial "utilities/CastBool.html" (.Parent.Get "fade") }}{{ end -}}
3131
{{- $fade = or $fade $parentFade -}}
3232
{{- $title := or $args.title $args.header -}}
33-
{{- $body := trim .Inner " \r\n" | .Page.RenderString -}}
33+
{{- $body := trim .Inner " \r\n" -}}
3434
{{- $current := "" -}}
3535

3636
{{/* Main code */}}
3737
{{- $output := partial "assets/nav-item.html" (dict
38+
"page" .Page
3839
"id" $id
3940
"parent-id" $parent
4041
"fade" $fade
@@ -57,6 +58,7 @@
5758
{{- end }}
5859

5960
{{- $alternative := partial "assets/nav-item" (dict
61+
"page" .Page
6062
"id" $id
6163
"parent-id" $parent
6264
"fade" $fade

layouts/_shortcodes/nav.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
{{- $innerTitles := .Scratch.Get "inner-title" -}}
2222
{{- $input := trim .Inner " \r\n" -}}
2323
{{- if $input -}}
24-
{{ $input = replace $input "\n" "\n " -}}
25-
{{ warnf "Unexpected inner content: %s\r\n %s" .Position $input -}}
26-
{{ end }}
24+
{{- $input = replace $input "\n" "\n " -}}
25+
{{- warnf "Unexpected inner content: %s\r\n %s" .Position $input -}}
26+
{{- end -}}
2727

2828
{{/* Main code */}}
2929
{{- if not $args.err -}}
@@ -41,4 +41,4 @@
4141
"width" $args.width
4242
)
4343
-}}
44-
{{ end }}
44+
{{- end -}}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gethinode/hinode",
3-
"version": "1.0.0-alpha5",
3+
"version": "1.0.0-alpha6",
44
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
55
"keywords": [
66
"hugo",

0 commit comments

Comments
 (0)