Merge branch 'hotfix/21.56.9' into master
[gitter.git] / server / api / private / markdown-preview.js
blobd88ec275eddcaba4dd69c37c380336d5f3072468
1 'use strict';
3 var processText = require('gitter-web-text-processor');
4 var StatusError = require('statuserror');
6 function markdownPreview(req, res, next) {
7 if (!req.user) {
8 return next(new StatusError(401));
10 return processText(req.body.text)
11 .then(function(parsed) {
12 res.set('Content-Type', 'text/html');
13 res.send(parsed.html);
15 .catch(next);
18 module.exports = markdownPreview;