changing all calls to marked to instead go through

PostTools.markdownToHTML
v1.18.x
Julian Lam 12 years ago
parent f40bf46656
commit 99ba792e6d

@ -63,7 +63,7 @@ var RDB = require('./redis.js'),
io.sockets.in('topic_' + tid).emit('event:post_edited', { io.sockets.in('topic_' + tid).emit('event:post_edited', {
pid: pid, pid: pid,
title: title, title: title,
content: marked(content || '') content: PostTools.markdownToHTML(content)
}); });
}); });
}); });

@ -1,7 +1,6 @@
var RDB = require('./redis.js'), var RDB = require('./redis.js'),
utils = require('./../public/src/utils.js'), utils = require('./../public/src/utils.js'),
schema = require('./schema.js'), schema = require('./schema.js'),
marked = require('marked'),
user = require('./user.js'), user = require('./user.js'),
topics = require('./topics.js'), topics = require('./topics.js'),
favourites = require('./favourites.js'), favourites = require('./favourites.js'),
@ -10,10 +9,6 @@ var RDB = require('./redis.js'),
feed = require('./feed.js'), feed = require('./feed.js'),
async = require('async'); async = require('async');
marked.setOptions({
breaks: true
});
(function(Posts) { (function(Posts) {
Posts.minimumPostLength = 8; Posts.minimumPostLength = 8;
@ -43,7 +38,7 @@ marked.setOptions({
post.user_rep = userData.reputation || 0; post.user_rep = userData.reputation || 0;
post.user_postcount = userData.postcount || 0; post.user_postcount = userData.postcount || 0;
post.picture = userData.picture || require('gravatar').url('', {}, https=global.nconf.get('https')); post.picture = userData.picture || require('gravatar').url('', {}, https=global.nconf.get('https'));
post.signature = marked(userData.signature || ''); post.signature = postTools.markdownToHTML(userData.signature);
if(post.editor !== '') { if(post.editor !== '') {
user.getUserFields(post.editor, ['username', 'userslug'], function(editorData) { user.getUserFields(post.editor, ['username', 'userslug'], function(editorData) {
@ -243,7 +238,7 @@ marked.setOptions({
timeout: 2000 timeout: 2000
}); });
postData.content = marked(postData.content); postData.content = postTools.markdownToHTML(postData.content);
postData.post_rep = 0; postData.post_rep = 0;
postData.relativeTime = utils.relativeTime(postData.timestamp) postData.relativeTime = utils.relativeTime(postData.timestamp)
postData.fav_star_class = 'icon-star-empty'; postData.fav_star_class = 'icon-star-empty';

@ -1,5 +1,6 @@
var user = require('./../user.js'), var user = require('./../user.js'),
posts = require('./../posts.js'), posts = require('./../posts.js'),
postTools = require('../postTools'),
fs = require('fs'), fs = require('fs'),
utils = require('./../../public/src/utils.js'), utils = require('./../../public/src/utils.js'),
path = require('path'), path = require('path'),
@ -229,7 +230,7 @@ var user = require('./../user.js'),
userData.posts = posts.filter(function(p) {return p.deleted !== "1";}); userData.posts = posts.filter(function(p) {return p.deleted !== "1";});
userData.isFollowing = isFollowing; userData.isFollowing = isFollowing;
userData.signature = marked(userData.signature || ''); userData.signature = postTools.markdownToHTML(userData.signature);
res.json(userData); res.json(userData);
}); });
}); });

@ -293,7 +293,7 @@ marked.setOptions({
timestamp = postData.timestamp; timestamp = postData.timestamp;
if(postData.content) if(postData.content)
stripped = utils.strip_tags(marked(postData.content)); stripped = utils.strip_tags(postTools.markdownToHTML(postData.content));
callback(null, { callback(null, {
"text": stripped, "text": stripped,

Loading…
Cancel
Save