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; flex-direction: column;
} }
.strikethrough {
text-decoration: line-through;
}
.underline {
text-decoration: underline;
}
.bold { .bold {
font-weight: bold; font-weight: bold;
} }
@ -230,6 +238,7 @@ a .post-name:hover, pre a, pre a:visited, a:hover {
.table-head { .table-head {
background: #98e; background: #98e;
text-align: left;
} }
td, th { td, th {

@ -5,13 +5,15 @@ const Posts = require(__dirname+'/../../db/posts.js')
, pinktextRegex = /^<([^<].+)/gm , pinktextRegex = /^<([^<].+)/gm
, boldRegex = /""(.+)""/gm , boldRegex = /""(.+)""/gm
, titleRegex = /==(.+)==/gm , titleRegex = /==(.+)==/gm
, italicRegex = /__(.+)__/gm , underlineRegex = /__(.+)__/gm
, strikethroughRegex = /~~(.+)~~/gm
, italicRegex = /\*\*(.+)\*\*/gm
, linkRegex = /https?\:\/\/[^\s<>\[\]{}|\\^]+/g , linkRegex = /https?\:\/\/[^\s<>\[\]{}|\\^]+/g
, spoilerRegex = /\|\|(.+)\|\|/gm , spoilerRegex = /\|\|(.+)\|\|/gm
, detectedRegex = /(\(\(\(.+\)\)\))/gm , detectedRegex = /(\(\(\(.+\)\)\))/gm
, codeRegex = /^```\s([\s\S]+)\s```/gm; , codeRegex = /^```\s([\s\S]+)\s```/gm;
module.exports = (board, thread, text) => { module.exports = (text) => {
//pinktext //pinktext
text = text.replace(pinktextRegex, (match, pinktext) => { text = text.replace(pinktextRegex, (match, pinktext) => {
@ -33,6 +35,21 @@ module.exports = (board, thread, text) => {
return `<strong>${bold}</strong>`; 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 //titles
text = text.replace(titleRegex, (match, title) => { text = text.replace(titleRegex, (match, title) => {
return `<span class='title'>${title}</span>`; return `<span class='title'>${title}</span>`;

@ -225,7 +225,7 @@ module.exports = async (req, res, next) => {
let message = req.body.message; let message = req.body.message;
let quotes = []; let quotes = [];
if (message && message.length > 0) { 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); const { quotedMessage, threadQuotes } = await linkQuotes(req.params.board, message);
message = quotedMessage; message = quotedMessage;
quotes = threadQuotes; quotes = threadQuotes;

Loading…
Cancel
Save