From c9e85f129480bf48d9ae064d7d0b476c56452ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o=20Soares=20dos=20Santos?= Date: Tue, 14 Jul 2015 20:51:22 +0100 Subject: [PATCH] fix(subParsers/italicsAndBold): fix underscores not being correctly parsed when used in conjunction with literalMidWordsUnderscores option --- src/subParsers/italicsAndBold.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/subParsers/italicsAndBold.js b/src/subParsers/italicsAndBold.js index 19d95e3..4a2fa4d 100644 --- a/src/subParsers/italicsAndBold.js +++ b/src/subParsers/italicsAndBold.js @@ -4,8 +4,8 @@ showdown.subParser('italicsAndBold', function (text, options) { if (options.literalMidWordUnderscores) { //underscores // Since we are consuming a \s character, we need to add it - text = text.replace(/(^|\s)__(?=\S)([^]+?)__(?=\s|$)/gm, '$1$2'); - text = text.replace(/(^|\s)_(?=\S)([^]+?)_(?=\s|$)/gm, '$1$2'); + text = text.replace(/(^|\s|>|\b)__(?=\S)([^]+?)__(?=\b|<|\s|$)/gm, '$1$2'); + text = text.replace(/(^|\s|>|\b)_(?=\S)([^]+?)_(?=\b|<|\s|$)/gm, '$1$2'); //asterisks text = text.replace(/\*\*(?=\S)([^]+?)\*\*/g, '$1'); text = text.replace(/\*(?=\S)([^]+?)\*/g, '$1');