diff --git a/helpers/paramconverter.js b/helpers/paramconverter.js
index d53f4d12..c4574a7b 100644
--- a/helpers/paramconverter.js
+++ b/helpers/paramconverter.js
@@ -24,7 +24,7 @@ module.exports = (req, res, next) => {
for (let i = 0; i < trimFields.length; i++) {
const field = trimFields[i];
if (req.body[field]) {
- req.body[field] = req.body[field].trim();
+ req.body[field] = req.body[field].trimEnd();
}
}
diff --git a/helpers/posting/markdown.js b/helpers/posting/markdown.js
index 99649a39..b9179e54 100644
--- a/helpers/posting/markdown.js
+++ b/helpers/posting/markdown.js
@@ -11,7 +11,7 @@ const Posts = require(__dirname+'/../../db/posts.js')
, linkRegex = /https?\:\/\/[^\s<>\[\]{}|\\^]+/g
, spoilerRegex = /\|\|(.+)\|\|/gm
, detectedRegex = /(\(\(\(.+\)\)\))/gm
- , codeRegex = /^```\s([\s\S]+)\s```/gm;
+ , codeRegex = /```([\s\S]+?)```/gm;
module.exports = (text) => {
@@ -67,7 +67,7 @@ module.exports = (text) => {
//code
text = text.replace(codeRegex, (match, code) => {
- return `${code.trim()}`;
+ return `${code.replace(/^\s*\n/, '')}`;
});
//detected