13

https://stackoverflow.com/posts/6220514/revisions

How do I do a multi-line string in node.js?

I tried to make these characters: [var str = "Some \ ] show as having a space at the end without the brackets involved, but was not able to. While that would be doable on

var str = "Some \

that syntax, it's hard to indicate there's a space after the slash.

SOOOO, without using another character (like a light mid dot) to indicate the space therein, is that possible with markdown?

For reference:

var str = "Some \ //has a space

vs

var str = "Some \ //does not have a space

2
  • 1
    If you actually put a space, there is one there (and it's selectable, etc.). Markdown renders it inside a <code> tag which doesn't clobber spaces on rendering. What would you propose? It may just be incumbent upon the poster to indicate that spaces belong there. Commented Jun 2, 2011 at 22:21
  • @Daniel, see the new edit. I want the last two code lines to look differently.
    – jcolebrand
    Commented Jun 2, 2011 at 22:25

2 Answers 2

5

If you need to make it apparent that there's a space, you'll have to do more than put one, you'll have to emphasize it elsewhere anyway. Compare, visually:

    no space here \
    but there is a space here \ 

(rendered with an unbreakable space, which is not a good idea when posting code since if you do copy-paste it it usually won't work). So you might as well use a visually distinct character, traditionally ␣:

    explicitly indicated space \␣ (note that means a space character)

There's a similar problem when you need to indicate a literal control character, which is less frequent but does happen occasionally:

    ␛knew title␛\ (where means a literal escape character, i.e., press Ctrl+V then Esc)

2

You can do this by prepending the line with space characters, instead of using backticks.

The following line should end with 6 spaces

var str = "Some \      

vs

var str = "Some \ //does not have a space

But I'm not sure how to do this within a backtick code block.

2
  • The intent was to avoid using "// has six spaces" at all. I don't guess I made the link out to the revisions page prominent enough to reference the original question. Also note that in my question, I purposefully showed that I knew that I could use the code block syntax. Note the 2756 rep on meta ... I know this network pretty well.
    – jcolebrand
    Commented Jun 2, 2011 at 22:45
  • I guess I misunderstood your question. Commented Jun 2, 2011 at 23:12

You must log in to answer this question.

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