Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

What about Line Breaks in Jade?

I'm pretty sure that this is a no-brainer but I didn't find any snippet of sample code. What's the best way to insert line breaks (aka the good ol' br/)?

As far as I can see if I put a "br" at the beginning of an empty line, it is rendered as <br/> but if I have to show several lines of text, the resulting code is quite verbose:

.poem 
 p 
 | Si chiamava Tatiana, la sorella... 
 br 
 | Noi siamo i primi, almeno lo crediamo
 br 
 | Che un tale nome arditamente nella
 br 
 | Cornice d’un romanzo introduciamo.
 br 
 | E che dunque? E’ piacevole, sonoro.
 br 
 | Lo so che a molti privo di decoro 
 br 
 | Apparirà, già fuori moda, e degno
 br 
 | Piuttosto d’un ancella, certo segno, 
 br 
 | confessiamolo pur senza paura,
 br 
 | di quanto s’è noialtri al gusto avversi
 br 
 | nei nostri nomi (a non parlar di versi). |br
 br 
 | Credemmo conquistare la cultura,
 br 
 | e non ne abbiamo preso, in conclusione,
 br 
 | che la ricerca dell’affettazione.

Is there a better way to solve this? (incidentally I'm asking for the same thing with the image tag...)

Answer*

Draft saved
Draft discarded
Cancel
1
  • 8
    not to nitpick, but according to a strict doctype, p tags can only contain inline elements, so your first example may not pass validation, depending on the doctype. Commented Mar 31, 2011 at 14:22

lang-js

AltStyle によって変換されたページ (->オリジナル) /