Files
coffeescript/documentation/sections/embedded.md

22 lines
647 B
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Embedded JavaScript
Hopefully, youll 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. Thats easier than escaping backticks, if you need them inside your JavaScript block.
```
codeFor('embedded_block', 'time()')
```