How to add br tag with Jade HTML
Asked Answered
T

2

15

I need add br tag but this not working.

table
    tbody
        td Juan Perez
        td 01 33 4455 6677
        td Av José Vasconcelos 804-A Pte. 
            br Col. Los Sabinos,CP. 66220, San Pedro, N.L.
Tipple answered 6/1, 2016 at 21:49 Comment(2)
duplicate: #5434477Neptunium
Does this answer your question? What about Line Breaks in Jade?Allopatric
D
20

Put the text on a new line with a preceding |:

table
  tbody
    tr
      td Juan Perez
      td 01 33 4455 6677
      td Av José Vasconcelos 804-A Pte.
        br
        | Col. Los Sabinos,CP. 66220, San Pedro, N.L.

You could also place both text nodes on new lines to improve readability as well:

table
  tbody
    tr
      td Juan Perez
      td 01 33 4455 6677
      td
        | Av José Vasconcelos 804-A Pte.
        br
        | Col. Los Sabinos,CP. 66220, San Pedro, N.L.

Output:

<table>
  <tbody>
    <tr>
      <td>Juan Perez</td>
      <td>01 33 4455 6677</td>
      <td>Av José Vasconcelos 804-A Pte.<br/>Col. Los Sabinos,CP. 66220, San Pedro, N.L.</td>
    </tr>
  </tbody>
</table>
Dobrinsky answered 6/1, 2016 at 21:53 Comment(0)
A
5

An alternative syntax to the one proposed by Josh is the following:

table
  tbody
    tr
      td Juan Perez
      td 01 33 4455 6677
      td. 
        Av José Vasconcelos 804-A Pte. #[br]
        Col. Los Sabinos,CP. 66220, San Pedro, N.L.

The dot at the end of the td is used to enter large blocks of plain text in a simpler way, so the following indented block is treated as text, and you don't need to use the pipe (|) preceding every line. (Source: https://pugjs.org/language/plain-text.html)

Then, to get your explicit <br>, you can use the tag interpolation syntax #[br] to inline it inside the text. (Source: https://pugjs.org/language/interpolation.html)

Aurea answered 6/3, 2020 at 20:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.