I am using Jade and everything is cool except that Jade "eats" my spaces.
For example, in HTML:
<b>Hello</b> <b>World</b>
or
<b>Hello</b> <b>World</b>
Will have a space between "Hello" and "World".
But when converting to Jade it'd be
b Hello b World
When rendered as HTML, the space is gone. Like:
<b>Hello</b><b>World</b>
Do I have to add
in my Jade template or is there any way I can get a normal space in the generated HTML?
You are encouraged to rest and self-isolate at home and you should only leave your house only when you need to seek medical attention, or to buy food or groceries. If your symptoms worsen or do not improve with time, please go back to see your doctor.
If you test positive for COVID-19, stay home for at least 5 days and isolate from others in your home. You are likely most infectious during these first 5 days. Wear a high-quality mask if you must be around others at home and in public. Do not go places where you are unable to wear a mask.
For persons identified as close contacts by TraceTogether data, some may receive a Health Risk Warning (HRW) or Health Risk Alert (HRA) depending on your degree of risk exposure. For Persons issued HRW, you will receive a notification via SMS.
Try to stay at home and avoid contact with other people if you: have any symptoms of COVID-19, and have a high temperature or you do not feel well enough to go to work or do your normal activities.
Of course, when you have two of the same tags after each other, you can simply merge them:
b Hello World
But, if you would have two different sibling tags and would want a space between them, you could use piping to output a space between them.
For example:
b Hello | <-- 2 spaces after the pipe i World
Note that when specifying tag contents / piping text, the actual text content is preceded by a white space. This white space is not outputted. So, in effect, to pipe a white-space you need a |
character followed by two spaces.
If you are in an environment where trailing spaces are not preserved, you can alternatively use the following:
b Hello =" " i World
=
evaluates a JavaScript expression and outputs the result.
Also note that
is not the same as a space in HTML. The correct HTML entity to use is  
(or  
if you like hexadecimal numbers).
stands for non-breaking space. Its character code is 160 ( 
). The difference is that where an ordinary space is used, multiple spaces will be shown as a single space and if a line overflows, the text will continue on the next line.* Non-breaking spaces on the other hand will allways be shown. Lines will never wrap where a non-breaking space is used.
This is best illustrated with an example:
(Note the scroll bar at the bottom.)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (Note there is no scroll bar because all spaces are concatenated into one.)
* This can be overridden with the CSS white-space
property. Some elements, such as <pre>
, display all white space and line endings by default.
This should do it:
b Hello | World
Unfortunately it produces this HTML output in Chrome on my machine:
<b> Hello World</b>
But in the end it becomes:
To come to an end
b Hello b World
...will do it too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With