From 9f11948c8622248f2f0bd9c9e5d96dfcf2944484 Mon Sep 17 00:00:00 2001
From: Marcin Kurczewski <mkurczew@gmail.com>
Date: Sun, 9 Nov 2014 10:44:02 +0100
Subject: [PATCH] Fixed escaping strike-through

---
 public_html/js/Util.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/public_html/js/Util.js b/public_html/js/Util.js
index 983ea63c..5750f700 100644
--- a/public_html/js/Util.js
+++ b/public_html/js/Util.js
@@ -189,7 +189,9 @@ App.Util = function(_, jQuery, marked, promise) {
 
 		var preDecorator = function(text) {
 			//prevent ^#... from being treated as headers, due to tag permalinks
-			text = text.replace(/^#/g, '%%%#');
+			text = text.replace(/^#/g, '%%%\0');
+			//fix \ before ~ being stripped away
+			text = text.replace(/\\~/g, '%%%\0');
 			return text;
 		};
 
@@ -202,7 +204,7 @@ App.Util = function(_, jQuery, marked, promise) {
 			//spoilers
 			text = text.replace(/\[spoiler\]((?:[^\[]|\[(?!\/?spoiler\]))+)\[\/spoiler\]/ig, '<span class="spoiler">$1</span>');
 			//strike-through
-			text = text.replace(/(~~|~)([^~]+)\1/g, '<del>$2</del>');
+			text = text.replace(/(^|[^\\])(~~|~)([^~]+)\2/g, '$1<del>$3</del>');
 			//post premalinks
 			text = text.replace(/(^|[\s<>\(\)\[\]])@(\d+)/g, '$1<a href="#/post/$2"><code>@$2</code></a>');
 			//user permalinks