Skip to content

Instantly share code, notes, and snippets.

@jameswyse
Created March 25, 2012 09:35
Show Gist options
  • Save jameswyse/2192568 to your computer and use it in GitHub Desktop.
Save jameswyse/2192568 to your computer and use it in GitHub Desktop.
Render markdown in node/express with variables
// You need to install 'node-markdown': `npm install node-markdown`
// In your app.configure section add 'md' to 'view options' ie:
app.set('view options', { layout: 'layouts/index', md: require("node-markdown").Markdown })
// Then in your jade template you can use:
div!=md(text)
@jameswyse
Copy link
Author

This was driving me crazy and I couldn't find anything on the net about how to do this, hopefully this will help someone!

Apparently the :markdown filter does not support variables as it's rendered at compile time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment