summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/lib/inlines.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/js/lib/inlines.js b/js/lib/inlines.js
index 0dc5e3c..4d49861 100644
--- a/js/lib/inlines.js
+++ b/js/lib/inlines.js
@@ -65,6 +65,8 @@ var reEntityHere = new RegExp('^' + ENTITY, 'i');
var reEntityOrEscapedChar = new RegExp('\\\\' + ESCAPABLE + '|' + ENTITY, 'gi');
+var reBackslashOrAmp = /[\\&]/;
+
var reTicks = new RegExp('`+');
var reTicksHere = new RegExp('^`+');
@@ -102,7 +104,11 @@ var unescapeChar = function(s) {
// Replace entities and backslash escapes with literal characters.
var unescapeString = function(s) {
"use strict";
- return s.replace(reEntityOrEscapedChar, unescapeChar);
+ if (reBackslashOrAmp.test(s)) {
+ return s.replace(reEntityOrEscapedChar, unescapeChar);
+ } else {
+ return s;
+ }
};
// Normalize reference label: collapse internal whitespace