Bladeren bron

Merge pull request #469 from jfmercer/string-literals

Documents use of string literals containing double quotes
tags/v2.1.3
Phillip Johnsen 10 jaren geleden
bovenliggende
commit
5b43a4f613
1 gewijzigde bestanden met toevoegingen van 6 en 0 verwijderingen
  1. +6
    -0
      README.md

+ 6
- 0
README.md Bestand weergeven

@@ -106,6 +106,8 @@ The most basic tag type is a simple variable. A `{{name}}` tag renders the value

All variables are HTML-escaped by default. If you want to render unescaped HTML, use the triple mustache: `{{{name}}}`. You can also use `&` to unescape a variable.

To print `{{name}}` as a string literal, the default delimiters must be changed. See the ["Set Delimiter'](https://github.com/janl/mustache.js#set-delimiter) section for more information about custom delimiters.

View:

```json
@@ -123,6 +125,9 @@ Template:
* {{company}}
* {{{company}}}
* {{&company}}
{{=<% %>=}}
* {{company}}
<%={{ }}=%>
```

Output:
@@ -133,6 +138,7 @@ Output:
* &lt;b&gt;GitHub&lt;/b&gt;
* <b>GitHub</b>
* <b>GitHub</b>
* {{company}}
```

JavaScript's dot notation may be used to access keys that are properties of objects in a view.


Laden…
Annuleren
Opslaan