What about Line Breaks in Jade?

前端 未结 10 1798
情书的邮戳
情书的邮戳 2020-12-08 03:46

I\'m pretty sure that this is a no-brainer but I didn\'t find any snippet of sample code. What\'s the best way to insert line breaks (aka the good ol\' br/)?

As far

10条回答
  •  春和景丽
    2020-12-08 04:30

    I was able to do the following after @haxxxton

    app.use(function(req, res, next){
      var contentParse = function (content){
          content = content.replace(/\n?\r\n/g, '
    ' ); return content; }; res.locals.contentParse = contentParse; next(); });

    For example, it can be used in a jade template using the function p!= contentParse(post.description)

提交回复
热议问题