File: embedded.md

package info (click to toggle)
coffeescript 2.7.0%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,360 kB
  • sloc: makefile: 20; xml: 9; sh: 6; javascript: 5
file content (21 lines) | stat: -rw-r--r-- 647 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
## Embedded JavaScript

Hopefully, you’ll never need to use it, but if you ever need to intersperse snippets of JavaScript within your CoffeeScript, you can use backticks to pass it straight through.

```
codeFor('embedded', 'hi()')
```

Escape backticks with backslashes: `` \`​`` becomes `` `​``.

Escape backslashes before backticks with more backslashes: `` \\\`​`` becomes `` \`​``.

```
codeFor('embedded_escaped', 'markdown()')
```

You can also embed blocks of JavaScript using triple backticks. That’s easier than escaping backticks, if you need them inside your JavaScript block.

```
codeFor('embedded_block', 'time()')
```