From 8a8d76f5254c14b255b7d773d3c8d8ecfaee6061 Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Sat, 19 Nov 2016 23:09:26 -0800 Subject: [PATCH 1/2] Documentation for triple backticks and escaping backticks --- documentation/examples/embedded_block.coffee | 5 +++++ documentation/examples/embedded_escaped.coffee | 3 +++ documentation/index.html.js | 13 +++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 documentation/examples/embedded_block.coffee create mode 100644 documentation/examples/embedded_escaped.coffee diff --git a/documentation/examples/embedded_block.coffee b/documentation/examples/embedded_block.coffee new file mode 100644 index 0000000000..5ca5626ede --- /dev/null +++ b/documentation/examples/embedded_block.coffee @@ -0,0 +1,5 @@ +``` +function time() { + return `The time is ${new Date().toLocaleTimeString()}`; +} +``` diff --git a/documentation/examples/embedded_escaped.coffee b/documentation/examples/embedded_escaped.coffee new file mode 100644 index 0000000000..0eba110b41 --- /dev/null +++ b/documentation/examples/embedded_escaped.coffee @@ -0,0 +1,3 @@ +markdown = `function () { + return \`In Markdown, write code like \\\`this\\\`\`; +}` diff --git a/documentation/index.html.js b/documentation/index.html.js index 495201c269..ea4e2ffa11 100644 --- a/documentation/index.html.js +++ b/documentation/index.html.js @@ -878,6 +878,19 @@ Block 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 embed blocks of JavaScript using triple backticks. Within triple-backtick + blocks, single backticks are ignored. +

+ <%= codeFor('embedded_block', 'time()') %>

From 8022788147fc2447666fde17fdd68ea0a041a664 Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Tue, 22 Nov 2016 14:33:57 -0800 Subject: [PATCH 2/2] Better explanation of escaped backticks within triple-backticks block --- documentation/index.html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/index.html.js b/documentation/index.html.js index ea4e2ffa11..e4d122b8c8 100644 --- a/documentation/index.html.js +++ b/documentation/index.html.js @@ -887,8 +887,8 @@ Block

<%= codeFor('embedded_escaped', 'markdown()') %>

- You can embed blocks of JavaScript using triple backticks. Within triple-backtick - blocks, single backticks are ignored. + 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()') %>