diff --git a/public_html/js/Util.js b/public_html/js/Util.js
index 5750f700..daa9b422 100644
--- a/public_html/js/Util.js
+++ b/public_html/js/Util.js
@@ -189,15 +189,16 @@ App.Util = function(_, jQuery, marked, promise) {
var preDecorator = function(text) {
//prevent ^#... from being treated as headers, due to tag permalinks
- text = text.replace(/^#/g, '%%%\0');
+ text = text.replace(/^#/g, '%%%#');
//fix \ before ~ being stripped away
- text = text.replace(/\\~/g, '%%%\0');
+ text = text.replace(/\\~/g, '%%%T');
return text;
};
var postDecorator = function(text) {
- //restore headers
- text = text.replace(/%%%/g, '');
+ //restore fixes
+ text = text.replace(/%%%T/g, '\\~');
+ text = text.replace(/%%%#/g, '#');
//search permalinks
text = text.replace(/\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]/ig, '$1
');
@@ -205,6 +206,7 @@ App.Util = function(_, jQuery, marked, promise) {
text = text.replace(/\[spoiler\]((?:[^\[]|\[(?!\/?spoiler\]))+)\[\/spoiler\]/ig, '$1');
//strike-through
text = text.replace(/(^|[^\\])(~~|~)([^~]+)\2/g, '$1$3');
+ text = text.replace(/\\~/g, '~');
//post premalinks
text = text.replace(/(^|[\s<>\(\)\[\]])@(\d+)/g, '$1@$2
');
//user permalinks