Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Andy Hu7,473 Points
Pug template multi line text content
The thing is, I went to barnyard ipsum site and generated some random text as the teacher says in the video, then I copied the whole paragraph and put it in the index.pug file after the "p" tag. But here's what I get from the browser:
Error: /Users/andy/Code/flashcards/views/index.pug:13:7 11| Augers oats hen cowpies. Ewes mushrooms zucchini in forage Harvester at sheep with tractor. Apples ducks straw, quail a ostriches donkey, hay hook cucumbers. Kidney beans ostrich trucks. Apples ducks straw, quail a ostriche. 12|
13| Donkey, hay hook cucumbers. Chainsaw foal hay hook, herbs at combine harvester, children is mallet. Haybine carrots soybeans, owls duck raising or, cheep in plows. Cauliflower a seeds quail. Feed in a woof, a farmers market. Post pounder calf, hay or duck is, tool shed horse. Apples ducks straw, quail a ostriches donkey, hay hook cucumbers. Veterinarian at Seeder eggs with watermelon ostriches. Mouse soybean. --------------^ 14| 15| Sweet corn hogs llamas or oink oink wind. Coo with rabbits ect. Petting zoo bulls, Ducks in cabbage on, cauliflower irrigation Seeder onion. Mallet herb. 16|
unexpected text ", hay"
It seems the paragram was pasted in multiple lines and it just won't work. How do I fix this?
I know that in the video the whole paragragh was in a single line, but how did he do that is there a convenient way without manually deleting the newline characters?
How do you put multiple lines as text content of an html element in pug?
Max Klopsch22,628 Points
You can find out how to enter multi-line text in a paragraph here: https://pugjs.org/language/plain-text.html#piped-text You need to add the pipe | character indented before each line.
When I try to get rid of formatting or new lines, I usually paste my text in the browser URL field and then copy it again from there.
You can of course also manually remove the new line characters. It also looks like you copied the line numbers and pipe characters from the website. Maybe you need to retry it and only select the text.