Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions data/structures/nav-item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ arguments:
raw:
group: partial
release: v1.3.0
raw-body:
type: bool
default: false
optional: true
group: shortcode
release: v3.21.0
comment: >-
Flag to pass the item's body through as already-rendered HTML instead of
running it through the page's markdown renderer. Set this when the body
is a nested shortcode that emits HTML of its own: on a site configured
with `markup.goldmark.renderer.unsafe = false`, that markup is otherwise
treated as raw HTML typed into markdown and is escaped or dropped.
navitem-type:
release: v1.0.0
illustration:
Expand Down
11 changes: 11 additions & 0 deletions layouts/_shortcodes/nav-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
{{- $itemID := printf "%s-btn-%d" $parent $id }}
{{- $disabledID := cond $args.disabled $itemID "" }}
{{- $body := trim .Inner " \r\n" -}}
{{/*
assets/nav-item.html resolves a pane body with `$args.body | $args.page.RenderString`,
which is right for prose but destroys a body that is already HTML — a nested shortcode's
output reaches RenderString indistinguishable from raw HTML typed into markdown, and a
site running goldmark with renderer.unsafe = false then escapes or drops it. The partial
already accepts a `raw` field that bypasses RenderString; raw-body wires it from the
shortcode. Empty when unset, so `or $args.raw (...)` keeps the original path.
*/}}
{{- $raw := cond $args.rawBody $body "" -}}
{{- $current := "" -}}

{{/* Main code */}}
Expand All @@ -50,6 +59,7 @@
"title" $title
"class" $args.class
"body" $body
"raw" $raw
"show" $args.show
"disabled" $args.disabled
"_default" $args.default
Expand Down Expand Up @@ -84,6 +94,7 @@
"title" $title
"class" $args.class
"body" $body
"raw" $raw
"show" $args.show
"disabled" $args.disabled
"navitem-type" "accordion"
Expand Down