Leslie Leslie - 1 year ago 285
HTML Question

Jade syntax about multiple line string in pre tag

I have Jade code like this:

pre='<!DOCTYPE html>\n<html lang="en">\nfoo bar\n</html>'

and it render like this:

<!DOCTYPE html>
<html lang="en">
foo bar

How can I achieve something like this:

pre='<!DOCTYPE html>\n'
+'<html lang="en">\n'
+'foo bar\n'

or like this:

pre="""<!DOCTYPE html>\n"""
"""<html lang="en">\n"""
"""foo bar\n"""

I have tried following code in jade-syntax-docs, it works!

| <!DOCTYPE html>
| <html lang="en">
| foo bar
| </html>

enter image description here

But it not works in my test website. My website is generated by express generator.
It render like this:

enter image description here

and html is this:

enter image description here

If jade version matters, this is

"name": "nodejs-crud",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"

By the way, I use

Answer Source

You can also do this :

| <!DOCTYPE html>
| foo bar
| </html>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download