Suppose the following chunk of code:

lines = text.split`\n`

Not relevant, but it is valid ES6 code

My question is: How to write it inside one comment? When I use backticks around content it displays the content formatted as code. But what if there are backticks inside this content?


1 Answer 1


Backslashes should do it. e.g.:

`lines = text.split\`\n\``

will produce the same formatting in a comment as you have in your question.

  • 1
    I think the OP might've meant meant inline code, not a comment. Doesn't seem to work there. (Or maybe I'm trying too hard to read things into the question.)
    – Cascabel
    Commented Jun 10, 2016 at 23:36
  • 1
    @Jefromi Hmm. Yeah, that seems to be busted. I thought multiple backticks would work there, but in testing it... guess not.
    – Adam Lear StaffMod
    Commented Jun 10, 2016 at 23:38
  • Ah, and there is a super-old dup for the inline version: meta.stackexchange.com/questions/55437/… - open and close with multiple backticks; that seems to work in comments too.
    – Cascabel
    Commented Jun 10, 2016 at 23:41
  • @Jefromi Aha, that's what I was thinking of. Thanks for digging it up.
    – Adam Lear StaffMod
    Commented Jun 10, 2016 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .