[2020-01-30] Writing Template Strings in Markdown

With template strings, the backtick (`) means something in Markdown and in JavaScript. This:

To display a message, write `alert(`hello world!`)`.

will result in:

To display a message, write alert(hello world!).

To avoid this, we can leverage a little-known feature that’s been in Markdown from the beginning: you can use multiple backticks as code delimiters, like this:

To display a message, write ``alert(`hello world!`)``.

This will now render things correctly:

To display a message, write alert(`hello world!`).

Edit on GithubPublished on 2020-01-30

Copyright © 2019...2020 Nick S. Plekhanov