Preserving newlines in Jade

≡放荡痞女 提交于 2019-12-04 09:54:16
jaime

In Jade's compiling options set pretty to true.

Which can be done in multiple ways depending of how you are compiling them

  • From the command line pass the -P or --pretty flag.
  • From express 3.x: app.locals.pretty = true;

(express 2.x used a different syntax: app.set('view options', { pretty: true });, see migration guide: https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x)

Then you can do the following

#test.     // <-- notice the dot
    Lorem Ipsum is simply dummy text of 
    the printing and typesetting industry. 
    Lorem Ipsum has been the industry's standard dummy 
    text ever since the 1500s ,
    when an unknown printer took a galley of type and scrambled 

which will produce

<div id="test">
    Lorem Ipsum is simply dummy text of 
    the printing and typesetting industry. 
    Lorem Ipsum has been the industry's standard dummy 
    text ever since the 1500s ,
    when an unknown printer took a galley of type and scrambled 
</div>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!