Pug template + assign attribute value5/17/2023 ![]() Pug: // Incorrect syntax for multi-line content ![]() In this example, Pug renders the p element as intended, but also renders the word "This" in the subline as an element of type This. If you don't use this syntax for multi-line content, Pug will interpret the lines underneath the element as separate elements. Pug: // Correct syntax for multi-line content To add multiple lines of content inside an element, put a period after the element's name and drop the content below, indenting each line. To put content inside an element, put a space after its tag name (on the same line) and add the content there. In this example, the head element is on an indented line underneath the html element, which renders it as a child of the html element. To create a child element, indent the line under the intended parent and create the child there. This is because Pug uses formatting elements (such as white space and indentation) to determine parent/child relationships between elements. Pug will automatically generate a closing tag for elements that require one, so you only have to write the opening tag.
0 Comments
Leave a Reply. |