.Kind (page): .Type (bugs) / .Layout ()
Bundle: n/a (regular page)
[ categories | projects | tags | search ]
Hugo Sandbox

This is an unofficial Hugo sandbox site to try to replicate possible bugs in hugo.

It is updated automatically after each commit to the hugo-sandbox repo. It was last updated on Jan 20, 2022 13:08 UTC.

This page was created/modified in commit 11956ad "Add test case for whitespace chomping not working inside shortcodes" on 2018-04-23.
Markdown source of this page

Whitespace chomping inside shortcodes

tags: chomp whitespace shortcode


Use of whitespace chomping braces in shortcodes.



Shortcode definition (inner-chomp)

<div>{{- .Inner -}}</div>

Shortcode use

{{< inner-chomp >}}
{{< /inner-chomp >}}

Expected HTML


Observed HTML

View the source of this page and search for “Hello”.



The workaround is to put the opening/closing shortcode identifiers on the same line.

{{< inner-chomp >}}Workaround{{< /inner-chomp >}}

View the source of this page and search for “Workaround”.


Page (Debug)

Page VariableValue
Name "Whitespace chomping inside shortcodes"
Title "Whitespace chomping inside shortcodes"
ResourceType "page"
Kind "page"
Section "bugs"
Draft false
Type "bugs"
Layout ""
Permalink "https://hugo-sandbox.netlify.com/bugs/whitespace-chomping-in-shortcodes/"
RelPermalink "/bugs/whitespace-chomping-in-shortcodes/"
page.Data{} (type:page.Data)
NextPageNotes on HEP course
PrevPageImage captions with Markdown
PrevInSectiondate and publishdate

Page Params (Debug)

maps.Params{"author":[]string{"Kaushal Modi"}, "creator":"Emacs 27.0.50 (Org mode 9.1.11 + ox-hugo)", "date":time.Date(2018, time.April, 23, 8, 46, 0, 0, time.Location("")), "description":"Use of whitespace chomping braces in shortcodes.", "draft":false, "iscjklanguage":false, "lastmod":time.Date(2018, time.April, 23, 8, 54, 6, 0, time.Location("")), "publishdate":time.Date(2018, time.April, 23, 8, 46, 0, 0, time.Location("")), "tags":[]string{"chomp", "whitespace", "shortcode"}, "title":"Whitespace chomping inside shortcodes"} (type:maps.Params)

File Object (Debug)

FileInfo VariableValue
UniqueID "9f1626a9785354434092e0dc66f3886f"
BaseFileName "whitespace-chomping-in-shortcodes"
TranslationBaseName "whitespace-chomping-in-shortcodes"
Lang "en"
Section "bugs"
LogicalName "whitespace-chomping-in-shortcodes.md"
Dir "bugs/"
Ext "md"
Path "bugs/whitespace-chomping-in-shortcodes.md"

This site is generated using the ox-hugo package for Emacs/Org-mode + hugo-bare-min-theme + Hugo 0.92.0 (commit b3549403) .

[Back to Hugo Sandbox home]