Pug: force add space to end of line

So I have this basic fraudster code

p This is some text
  span foo
  span bar

The expected result will look like this:

This is some text foo bar

However, it actually outputs this (the space is removed):

This is a text image.

You can add space by adding an empty space at the end of the line.

I need to be able to save a space, but when space trimming is enabled in my editor. Stacking white space removes white space from the end of a line when saving a file.

So, is there a way to force a space to be added to the end of a line that remains, even if space trimming is enabled in the editor?

+4
source share
2 answers

- . , .

// no extra spaces
p This is some text
  span foo
  span bar

// extra space method
p This is some text
  span  foo
  span  bar

// JS literals method
p This is some text!{' '}
  span foo
  | !{' '}
  span bar

, JS, , , .

HTML-:

<p>This is some text<span> foo</span><span> bar</span></p>

JS, HTML-:

<p>This is some text <span>foo</span> <span>bar</span></p>

HTML - :

<p>This is some text<span>foo</span><span>bar</span></p>
+2

:)

p This is some text!{' '}
  span foo
  | !{' '}
  span bar

!{} , , :

javascript ,

, !{' '} , , .

+3

Source: https://habr.com/ru/post/1676448/


All Articles