Skip to content

Commit

Permalink
Docs for triple-backticks and escaping backticks (#4369)
Browse files Browse the repository at this point in the history
* Documentation for triple backticks and escaping backticks

* Better explanation of escaped backticks within triple-backticks block
  • Loading branch information
GeoffreyBooth authored Nov 23, 2016
1 parent 8ea67ff commit 992eb49
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions documentation/examples/embedded_block.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```
function time() {
return `The time is ${new Date().toLocaleTimeString()}`;
}
```
3 changes: 3 additions & 0 deletions documentation/examples/embedded_escaped.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
markdown = `function () {
return \`In Markdown, write code like \\\`this\\\`\`;
}`
13 changes: 13 additions & 0 deletions documentation/index.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,19 @@ Block
use backticks to pass it straight through.
</p>
<%= codeFor('embedded', 'hi()') %>
<p>
Escape backticks with backslashes: <code>\`</code> becomes <code>`</code>.
</p>
<p>
Escape backslashes before backticks with more backslashes: <code>\\\`</code>
becomes <code>\`</code>.
</p>
<%= codeFor('embedded_escaped', 'markdown()') %>
<p>
You can also embed blocks of JavaScript using triple backticks. That's easier
than escaping backticks, if you need them inside your JavaScript block.
</p>
<%= codeFor('embedded_block', 'time()') %>

<p>
<span id="switch" class="bookmark"></span>
Expand Down

0 comments on commit 992eb49

Please sign in to comment.