Add 'detected' markdown

merge-requests/208/head
fatchan 5 years ago
parent 24206860a2
commit 860044fba8
  1. 7
      helpers/markdown.js

@ -8,6 +8,7 @@ const Posts = require(__dirname+'/../db/posts.js')
, italicRegex = /__(.+)__/gm
, linkRegex = /https?\:\/\/[^\s]+/g
, spoilerRegex = /\|\|(.+)\|\|/gm
, detectedRegex = /(\(\(\(.+\)\)\))/gm
, codeRegex = /^```\s([\s\S]+)\s```/gm;
module.exports = (board, thread, text) => {
@ -47,10 +48,16 @@ module.exports = (board, thread, text) => {
return `<span class='spoiler'>${spoiler}</span>`;
});
//code
text = text.replace(codeRegex, (match, code) => {
return `<span class='code'>${code.trim()}</span>`;
});
//detected
text = text.replace(detectedRegex, (match, detected) => {
return `<span class='detected'>${detected}</span>`;
});
return text;
}

Loading…
Cancel
Save