.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 Oct 09, 2018 14:48 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


Description/Summary

Use of whitespace chomping braces in shortcodes.

Content

Ref

Shortcode definition (inner-chomp)

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

Shortcode use

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

Expected HTML

<div>Hello</div>

Observed HTML

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

<div>
Hello
</div>

Workaround

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”.

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/"
RSSLink ""
Data
KeyTypeValue
Pageshugolib.Pages
NextPageNotes on HEP course
PrevPageImage captions with Markdown
NextInSectionNone
PrevInSectiondate and publishdate

Page Params (Debug)

KeyTypeValue
author[]string "Kaushal Modi"
creatorstring "Emacs 27.0.50 (Org mode 9.1.11 + ox-hugo)"
datetime.Time 2018-04-23 08:46:00 -0400 -0400
descriptionstring "Use of whitespace chomping braces in shortcodes."
draftbool false
iscjklanguagebool false
lastmodtime.Time 2018-04-23 08:54:06 -0400 -0400
publishdatetime.Time 2018-04-23 08:46:00 -0400 -0400
tags[]string "chomp" "whitespace" "shortcode"
titlestring "Whitespace chomping inside shortcodes"

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.50-DEV (commit d5d50e2f, using Chroma commit d5ca12b) .

[Back to Hugo Sandbox home]