underline and strikethrough added to post styling

merge-requests/208/head
fatchan 5 years ago
parent 9d61902568
commit 65486ebfbc
  1. 9
      gulp/res/css/style.css
  2. 21
      helpers/posting/markdown.js
  3. 2
      models/forms/makepost.js

@ -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 {

@ -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 `<strong>${bold}</strong>`;
});
//bold
text = text.replace(boldRegex, (match, bold) => {
return `<strong>${bold}</strong>`;
});
//underline
text = text.replace(underlineRegex, (match, underline) => {
return `<span class='underline'>${underline}</span>`;
});
//strikethrough
text = text.replace(strikethroughRegex, (match, strike) => {
return `<span class='strikethrough'>${strike}</span>`;
});
//titles
text = text.replace(titleRegex, (match, title) => {
return `<span class='title'>${title}</span>`;

@ -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;

Loading…
Cancel
Save