Docs for triple-backticks and escaping backticks (#4369)
* Documentation for triple backticks and escaping backticks * Better explanation of escaped backticks within triple-backticks block
This commit is contained in:
parent
8ea67ff3e9
commit
992eb49e92
|
@ -0,0 +1,5 @@
|
|||
```
|
||||
function time() {
|
||||
return `The time is ${new Date().toLocaleTimeString()}`;
|
||||
}
|
||||
```
|
|
@ -0,0 +1,3 @@
|
|||
markdown = `function () {
|
||||
return \`In Markdown, write code like \\\`this\\\`\`;
|
||||
}`
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue