I use the express js framework. I have a markdownified string from the database and want to render it as HTML in my jade template. I installed node-markdown and want to render it this way:
app.js
var md = require("node-markdown").Markdown;
template.jade
- each note in todo.notes
div= md(note.string)
However, it doesn't print out anything... any advice at this?
Thanks!
EDIT: solved it myself, just forgot to get the md variable into my view...
There is the concept of 'filters' that expose a 'compiler' or 'filter' visitor to a portion of the jade template.
Check out: https://github.com/visionmedia/jade
filters
:sass must have sass.js installed
:less must have less.js installed
:markdown must have markdown-js installed or node-discount
:cdata
:coffeescript must have coffee-script installed
You use it via this syntax in a template: http://jade-lang.com/reference/filters/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With