pug

Do I have to use   for space in Jade?


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 &nbsp; in my Jade template or is there any way I can get a normal space in the generated HTML?


Solution

  • 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:

    enter image description here

    To come to an end

    b Hello &nbsp;
    b World
    

    ...will do it too.