hugo/docs/content/en/functions/strings/Chomp.md
2023-10-20 09:43:56 +02:00

716 B

title linkTitle description categories keywords menu function relatedFunctions aliases
chomp chomp Removes any trailing newline characters.
functions
docs
parent
functions
aliases returnType signatures
chomp
any
strings.Chomp STRING
strings.Chomp
strings.Trim
strings.TrimLeft
strings.TrimPrefix
strings.TrimRight
strings.TrimSuffix
/functions/chomp

If the argument is of type template.HTML, returns template.HTML, else returns a string.

Useful in a pipeline to remove newlines added by other processing (e.g., markdownify).

{{ chomp "<p>Blockhead</p>\n" }} → "<p>Blockhead</p>"