diff --git a/gulp/res/css/style.css b/gulp/res/css/style.css index 1b9aa589..cd95522b 100644 --- a/gulp/res/css/style.css +++ b/gulp/res/css/style.css @@ -23,6 +23,14 @@ body { flex-direction: column; } +.strikethrough { + text-decoration: line-through; +} + +.underline { + text-decoration: underline; +} + .bold { font-weight: bold; } @@ -230,6 +238,7 @@ a .post-name:hover, pre a, pre a:visited, a:hover { .table-head { background: #98e; + text-align: left; } td, th { diff --git a/helpers/posting/markdown.js b/helpers/posting/markdown.js index bdbfb625..7ef2a5de 100644 --- a/helpers/posting/markdown.js +++ b/helpers/posting/markdown.js @@ -5,13 +5,15 @@ const Posts = require(__dirname+'/../../db/posts.js') , pinktextRegex = /^<([^<].+)/gm , boldRegex = /""(.+)""/gm , titleRegex = /==(.+)==/gm - , italicRegex = /__(.+)__/gm + , underlineRegex = /__(.+)__/gm + , strikethroughRegex = /~~(.+)~~/gm + , italicRegex = /\*\*(.+)\*\*/gm , linkRegex = /https?\:\/\/[^\s<>\[\]{}|\\^]+/g , spoilerRegex = /\|\|(.+)\|\|/gm , detectedRegex = /(\(\(\(.+\)\)\))/gm , codeRegex = /^```\s([\s\S]+)\s```/gm; -module.exports = (board, thread, text) => { +module.exports = (text) => { //pinktext text = text.replace(pinktextRegex, (match, pinktext) => { @@ -33,6 +35,21 @@ module.exports = (board, thread, text) => { return `${bold}`; }); + //bold + text = text.replace(boldRegex, (match, bold) => { + return `${bold}`; + }); + + //underline + text = text.replace(underlineRegex, (match, underline) => { + return `${underline}`; + }); + + //strikethrough + text = text.replace(strikethroughRegex, (match, strike) => { + return `${strike}`; + }); + //titles text = text.replace(titleRegex, (match, title) => { return `${title}`; diff --git a/models/forms/makepost.js b/models/forms/makepost.js index 998a8684..f1318a83 100644 --- a/models/forms/makepost.js +++ b/models/forms/makepost.js @@ -225,7 +225,7 @@ module.exports = async (req, res, next) => { let message = req.body.message; let quotes = []; if (message && message.length > 0) { - message = simpleMarkdown(req.params.board, req.body.thread, message); + message = simpleMarkdown(message); const { quotedMessage, threadQuotes } = await linkQuotes(req.params.board, message); message = quotedMessage; quotes = threadQuotes;