You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Join multiline strings with '' or '\n'? That's something I'm not sure about.
Joining with empty strings
If we join using '' the long strings that don't contain new lines will look like:
foo = ["abc def hello world"," rock stars"]
Result text: abc def hello world rock stars
Rendered markdown: <p>abc def hello world rock stars</p>
Note: The contributor needs to remember to add the empty space before "rock"
And when a contributor wants to add a new line he needs to add it explicitly (which sounds good):
foo = ["abc def hello world\n","rock stars"]
Result text: abc def hello world rock stars
Rendered markdown:
<p>abc def hello world
rock stars</p>
Note: The contributor needs to remember to add a double \n\n if he wants two paragraphs
This is the case for two different paragraphs
foo = ["abc def hello world\n\n","rock stars"]
Result text: abc def hello world rock stars
Rendered markdown:
<p>abc def hello world</p><p>rock stars</p>
Joining with a space
If we join with a space we're "fixing" the fact that the contributor needs to remember to add an empty space at the beginning of each line. But that's not very explicit and might confuse contributors.
Joining with a new line
foo = ["abc def hello world"," rock stars"]
Result text: abc def hello world\n rock stars
Rendered markdown:
<p>abc def hello world
rock stars</p>
foo = ["abc def hello world","\n",
" rock stars"]
Result text: abc def hello world\n\n rock stars
Rendered markdown:
<p>abc def hello world</p><p>rock stars</p>
This seems to be the cleanest.
Ideas? Comments?
The text was updated successfully, but these errors were encountered:
Join multiline strings with '' or '\n'? That's something I'm not sure about.
Joining with empty strings
If we join using '' the long strings that don't contain new lines will look like:
Result text:
abc def hello world rock stars
Rendered markdown:
<p>abc def hello world rock stars</p>
Note: The contributor needs to remember to add the empty space before "rock"
And when a contributor wants to add a new line he needs to add it explicitly (which sounds good):
Result text:
abc def hello world rock stars
Rendered markdown:
Note: The contributor needs to remember to add a double \n\n if he wants two paragraphs
This is the case for two different paragraphs
Result text:
abc def hello world rock stars
Rendered markdown:
Joining with a space
If we join with a space we're "fixing" the fact that the contributor needs to remember to add an empty space at the beginning of each line. But that's not very explicit and might confuse contributors.
Joining with a new line
Result text:
abc def hello world\n rock stars
Rendered markdown:
Result text:
abc def hello world\n\n rock stars
Rendered markdown:
This seems to be the cleanest.
Ideas? Comments?
The text was updated successfully, but these errors were encountered: