Passing raw Markdown text to Jade

后端 未结 4 1280
栀梦
栀梦 2021-02-02 09:57

I\'m playing around with my first Node.js Express application, and as every programmer knows, the first thing you should build when testing out a new framework is a blog! Anyway

4条回答
  •  梦毁少年i
    2021-02-02 10:58

    The node module node-markdown is deprecated. The marked is advanced new version. You can try like this

    var md = require('marked');
    

    Inside your router

    res.render('template', { md: md });
    

    Inside your jade template

    div!= md(note.string)
    

提交回复
热议问题