From 35d8f5446f6ffa4e26b4918193513934166a29fc Mon Sep 17 00:00:00 2001 From: knrt10 Date: Sat, 2 Mar 2019 17:19:35 +0530 Subject: [PATCH] Fixes #13187 --- .../rocketchat-markdown/lib/parser/original/markdown.js | 2 +- packages/rocketchat-markdown/tests/client.tests.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/rocketchat-markdown/lib/parser/original/markdown.js b/packages/rocketchat-markdown/lib/parser/original/markdown.js index db7105eb6183..0b7143d33e39 100644 --- a/packages/rocketchat-markdown/lib/parser/original/markdown.js +++ b/packages/rocketchat-markdown/lib/parser/original/markdown.js @@ -39,7 +39,7 @@ const parseNotEscaped = function(msg, message) { } // Support *text* to make bold - msg = msg.replace(/(^|>|[ >_~`])\*{1,2}([^\*\r\n]+)\*{1,2}([<_~`]|\B|\b|$)/gm, '$1*$2*$3'); + msg = msg.replace(/(|>|[ >_~`])\*{1,2}([^\*\r\n]+)\*{1,2}([<_~`]|\B|\b|$)/gm, '$1*$2*$3'); // Support _text_ to make italics msg = msg.replace(/(^|>|[ >*~`])\_{1,2}([^\_\r\n]+)\_{1,2}([<*~`]|\B|\b|$)/gm, '$1_$2_$3'); diff --git a/packages/rocketchat-markdown/tests/client.tests.js b/packages/rocketchat-markdown/tests/client.tests.js index c9867c271de6..54228ca9ef4c 100644 --- a/packages/rocketchat-markdown/tests/client.tests.js +++ b/packages/rocketchat-markdown/tests/client.tests.js @@ -26,14 +26,16 @@ const bold = { '*Hello': '*Hello', 'Hello*': 'Hello*', 'He*llo': 'He*llo', - '***Hello***': '***Hello***', - '***Hello**': '***Hello**', + '***Hello***': `*${ boldWrapper('Hello') }*`, + '***Hello**': `*${ boldWrapper('Hello') }`, '*Hello* this is dog': `${ boldWrapper('Hello') } this is dog`, 'Rocket cat says *Hello*': `Rocket cat says ${ boldWrapper('Hello') }`, 'He said *Hello* to her': `He said ${ boldWrapper('Hello') } to her`, '**Hello** this is dog': `${ boldWrapper('Hello') } this is dog`, 'Rocket cat says **Hello**': `Rocket cat says ${ boldWrapper('Hello') }`, 'He said **Hello** to her': `He said ${ boldWrapper('Hello') } to her`, + 'He was a**nn**oyed': `He was a${ boldWrapper('nn') }oyed`, + 'There are two o in f*oo*tball': `There are two o in f${ boldWrapper('oo') }tball`, }; const italic = {