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

31 lines
716 B
Markdown

---
title: chomp
linkTitle: chomp
description: Removes any trailing newline characters.
categories: [functions]
keywords: []
menu:
docs:
parent: functions
function:
aliases: [chomp]
returnType: any
signatures: [strings.Chomp STRING]
relatedFunctions:
- strings.Chomp
- strings.Trim
- strings.TrimLeft
- strings.TrimPrefix
- strings.TrimRight
- strings.TrimSuffix
aliases: [/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`](/functions/transform/markdownify)).
```go-html-template
{{ chomp "<p>Blockhead</p>\n" }} → "<p>Blockhead</p>"
```