do links last to prevent surrounding markdown from breaking link

merge-requests/208/head
fatchan 5 years ago
parent 6e2abb705e
commit 9bd6aa4339
  1. 10
      helpers/posting/markdown.js

@ -28,11 +28,6 @@ module.exports = (text) => {
return `<span class='greentext'>&gt;${greentext}</span>`;
});
//links
text = text.replace(linkRegex, (match) => {
return `<a rel='nofollow' referrerpolicy='same-origin' target='_blank' href='${match}'>${match}</a>`;
});
//bold
text = text.replace(boldRegex, (match, bold) => {
return `<span class='bold'>${bold}</span>`;
@ -82,6 +77,11 @@ module.exports = (text) => {
//dice rolls
text = text.replace(diceRegex, diceRoll);
//links
text = text.replace(linkRegex, (match) => {
return `<a rel='nofollow' referrerpolicy='same-origin' target='_blank' href='${match}'>${match}</a>`;
});
return text;
}

Loading…
Cancel
Save