Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/examples/escaping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: playground
example:
template: |
{{{{raw}}}}
{{raw block}}
{{{{/raw}}}}
preparationScript: |
Handlebars.registerHelper('raw', function(options) {
return options.fn()
});
---
24 changes: 18 additions & 6 deletions src/guide/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,29 @@ will render

::: v-pre

Handlebars content may be escaped in one of two ways, inline escapes or raw block helpers. Inline escapes created by
prefixing a mustache block with `\`. Raw blocks are created using `{{{{` mustache braces.
Handlebars content may be escaped in one of two ways, inline escapes or raw block helpers.

:::
Inline escapes created by prefixing a mustache block with `\`.

```handlebars
\{{escaped}}
{{#raw}}
\{{escaped}}
{{/raw}}
```

will render

```html
{{escaped}}
```

Raw blocks are created using `{{{{` mustache braces with a block helper. Note that the `#` has been removed. The `raw`
helper shown below is not a built-in helper.

:::

<Example examplePage="/examples/escaping.md" show="template"/>
<Example examplePage="/examples/escaping.md" show="preparationScript"/>

Raw blocks operate in the same manner as other [block helpers](block-helpers.html) with the distinction of the child
content is treated as a literal string.

<Example examplePage="/examples/escaping.md" show="output"/>