Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Partially messaging formatting for bold letters #13599

Merged
merged 1 commit into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const parseNotEscaped = function(msg, message) {
}

// Support *text* to make bold
msg = msg.replace(/(^|&gt;|[ >_~`])\*{1,2}([^\*\r\n]+)\*{1,2}([<_~`]|\B|\b|$)/gm, '$1<span class="copyonly">*</span><strong>$2</strong><span class="copyonly">*</span>$3');
msg = msg.replace(/(|&gt;|[ >_~`])\*{1,2}([^\*\r\n]+)\*{1,2}([<_~`]|\B|\b|$)/gm, '$1<span class="copyonly">*</span><strong>$2</strong><span class="copyonly">*</span>$3');

// Support _text_ to make italics
msg = msg.replace(/(^|&gt;|[ >*~`])\_{1,2}([^\_\r\n]+)\_{1,2}([<*~`]|\B|\b|$)/gm, '$1<span class="copyonly">_</span><em>$2</em><span class="copyonly">_</span>$3');
Expand Down
6 changes: 4 additions & 2 deletions packages/rocketchat-markdown/tests/client.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down