From 507cb52a7350fe21f0ce4b6efeb2798bd94a6d97 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 10 Nov 2014 22:28:52 +0100 Subject: [PATCH] Fixed strike-through in Markdown --- public_html/js/Util.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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