Skip to content

Instantly share code, notes, and snippets.

@joelanman
Last active June 29, 2018 09:42
Show Gist options
  • Save joelanman/263cbe51c6a33712f1ebfa697fa36d13 to your computer and use it in GitHub Desktop.
Save joelanman/263cbe51c6a33712f1ebfa697fa36d13 to your computer and use it in GitHub Desktop.
how to use marked
const express = require('express')
const router = express.Router()
const marked = require('marked')
// Route index page
router.get('/', function (req, res) {
res.render('index')
})
// Add your routes here - above the module.exports line
router.post('/admin/plan-types/create/todo/main-content-preview', function (req, res){
req.session.data['todo-main-content-rendered'] = marked(req.session.data['todo-main-content'])
res.redirect('/admin/plan-types/create/todo/main-content-preview')
})
module.exports = router
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment