Here is the comment I wrote, but the back ticks do not display as code. It works in this post. How to fix?
No, I got => ["this", "is", "the", "string", "to's", "split", "real", "", "ok", "", "nice-like"]
which has one empty string.
Meta Stack Exchange is a question and answer site for meta-discussion of the Stack Exchange family of Q&A websites. It only takes a minute to sign up.
Sign up to join this communityHere is the comment I wrote, but the back ticks do not display as code. It works in this post. How to fix?
No, I got => ["this", "is", "the", "string", "to's", "split", "real", "", "ok", "", "nice-like"]
which has one empty string.
You must not have blank space after the first backtick or before the last backtick.
In your comment to that answer you do have space before the last backtick:
Apparently the code filter in the comments is different and more "strict" than the filter in the posts but this explains this issue.
Whether by design or a bug, only developer can tell. :)
If you do want a space as the first or last character in between the backticks, there's a (quite ugly) workaround:
Write
<backtick><U+2060><space>...some code...<backtick>
or
<backtick>...some code...<space><U+2060><backtick>
Note the U+2060
, which is the Unicode word joiner (WJ). It's zero width (hence invisible) and non-breaking. You can copy-paste it from here:
«»
It's enclosed in between «
and »
. You may need to select/copy the whole line (all three characters) to catch it, and then remove the enclosing characters after pasting.
Warning: there is a chance that when someone copies the code ( ...some code...
) including the invisible word joiner and pastes that into a code editor or a terminal, something won't work and, since the WJ is invisible, it's not obvious why it doesn't work. (I don't know if there's a solution to this..)
=> ["this", "is", "the", "string", "to's", "split", "real", "", "ok", "", "nice-like"]
which has one empty string.= Working
No, I got => ["this", "is", "the", "string", "to's", "split", "real", "", "ok", "", "nice-like"]
<backtick><space><...some text...><backtick><dot>
. The<dot>
will function as ”end of sentence“. After that, I'm going to write<backtick><...some more text...><backtick><dot>
; this time there's no space. In the demo you will see that the text between the two code sections (!) will be monospace. — Here's the demo: ` ...some text.... Here comes the second code section:
...some more text...`