☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

trim_text

Table of contents

Description:

This key toggles whether all whitespace and newlines will be trimmed from the start and end of the content before it is presented to an editor in CloudCannon.

Setting this key to true will trim all whitespace and newlines from the start and end of the content.

By default, this key is false (i.e., whitespace and newlines are not trimmed).

Appears in:
└── Snippet
    └── params
        └── *
            └── Content Parser Configuration
                └── options
                    └── trim_text
Type:
boolean
Examples:
Copied to clipboard
parser: content
options:
  editor_key: highlighted_text
  trim_text: true
{
  "parser": "content",
  "options": {
    "editor_key": "highlighted_text",
    "trim_text": true
  }
}

Example usage:

Markdown
Copied to clipboard
## My blog post

<<highlight>>
  My highlighted content!   
<</highlight>>

<<highlight>>  My highlighted content!  <</highlight>> 

Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Both of these will parse as My highlighted content!, despite the newlines and whitespace surrounding them.

To add whitespace back in when outputting the snippet, use the Style options.

Open in a new tab