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: Inconsistent Markdown Formatting in Custom Status Field #32574

Merged
merged 31 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d0399cd
fix: Omnichannel skeleton loading padding while creating new channel
Kishn0109 May 14, 2023
59e0e51
revert changes to push on dev
Kishn0109 May 14, 2023
a5ba1f2
Merge branch 'RocketChat:develop' into develop
Kishn0109 May 26, 2023
f5712b3
Merge branch 'RocketChat:develop' into develop
Kishn0109 Oct 14, 2023
2bfe3e1
Merge branch 'RocketChat:develop' into develop
Kishn0109 Jun 3, 2024
7b35316
fix: correct token type to 'strong' for asterisk-wrapped text
Kishn0109 Jun 8, 2024
e5866bb
chore: remove console.log
Kishn0109 Jun 8, 2024
d566f48
chore: Add changeset
Kishn0109 Jun 8, 2024
ccd0a53
fix: italic format in markdownText
Kishn0109 Jun 11, 2024
04653c5
Update .changeset/kind-drinks-joke.md
csuadev Jun 12, 2024
5ff7433
Merge branch 'develop' into fix/apply-strong-if-asterisk
casalsgh Jul 5, 2024
b890043
Merge branch 'develop' into fix/apply-strong-if-asterisk
csuadev Jul 25, 2024
f534b10
Merge branch 'develop' into fix/apply-strong-if-asterisk
scuciatto Jul 29, 2024
4d12f28
Merge branch 'develop' into fix/apply-strong-if-asterisk
MarcosSpessatto Aug 2, 2024
a2cef2f
Merge branch 'develop' into fix/apply-strong-if-asterisk
scuciatto Aug 8, 2024
4ca135f
Merge branch 'develop' into fix/apply-strong-if-asterisk
csuadev Aug 8, 2024
c595dfb
Merge branch 'develop' into fix/apply-strong-if-asterisk
MarcosSpessatto Aug 9, 2024
556188f
Merge branch 'develop' into fix/apply-strong-if-asterisk
MarcosSpessatto Aug 12, 2024
7f816f6
Merge branch 'develop' into fix/apply-strong-if-asterisk
scuciatto Aug 13, 2024
4d44330
Merge branch 'develop' into fix/apply-strong-if-asterisk
sampaiodiego Aug 13, 2024
5bfc3fe
Merge branch 'develop' into fix/apply-strong-if-asterisk
MarcosSpessatto Aug 15, 2024
7e5e374
Merge branch 'develop' into fix/apply-strong-if-asterisk
kodiakhq[bot] Aug 15, 2024
217a3ae
Merge branch 'develop' into fix/apply-strong-if-asterisk
KevLehman Aug 15, 2024
22d6873
Merge branch 'develop' into fix/apply-strong-if-asterisk
kodiakhq[bot] Aug 15, 2024
57b6f08
Merge branch 'develop' into fix/apply-strong-if-asterisk
csuadev Aug 16, 2024
16078d0
Merge branch 'develop' into fix/apply-strong-if-asterisk
kodiakhq[bot] Aug 16, 2024
8db57be
Merge branch 'develop' into fix/apply-strong-if-asterisk
kodiakhq[bot] Aug 16, 2024
f07d8c4
Merge branch 'develop' into fix/apply-strong-if-asterisk
kodiakhq[bot] Aug 19, 2024
5ed91f4
Merge branch 'develop' into fix/apply-strong-if-asterisk
kodiakhq[bot] Aug 19, 2024
b3919d0
Merge branch 'develop' into fix/apply-strong-if-asterisk
kodiakhq[bot] Aug 20, 2024
5814d01
Merge branch 'develop' into fix/apply-strong-if-asterisk
kodiakhq[bot] Aug 20, 2024
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
5 changes: 5 additions & 0 deletions .changeset/kind-drinks-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed issue with asterisk-wrapped text not becoming bold when user enters profile custom status.
18 changes: 11 additions & 7 deletions apps/meteor/client/components/MarkdownText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@ type MarkdownTextParams = {
withTruncatedText: boolean;
} & ComponentProps<typeof Box>;

const walkTokens = (token: marked.Token) => {
const boldPattern = /^\*.*\*$|^\*.*|.*\*$/;
const italicPattern = /^__(?=\S)([\s\S]*?\S)__(?!_)|^_(?=\S)([\s\S]*?\S)_(?!_)/;
if (boldPattern.test(token.raw)) {
token.type = 'strong';
} else if (italicPattern.test(token.raw)) {
token.type = 'em';
}
};

marked.use({ walkTokens });
const documentRenderer = new marked.Renderer();
const inlineRenderer = new marked.Renderer();
const inlineWithoutBreaks = new marked.Renderer();

marked.Lexer.rules.gfm = {
...marked.Lexer.rules.gfm,
strong: /^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
em: /^__(?=\S)([\s\S]*?\S)__(?!_)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
};

const linkMarked = (href: string | null, _title: string | null, text: string): string =>
`<a href="${href}" rel="nofollow noopener noreferrer">${text}</a> `;
const paragraphMarked = (text: string): string => text;
Expand Down Expand Up @@ -112,7 +117,6 @@ const MarkdownText = ({
const markedHtml = /inline/.test(variant)
? marked.parseInline(new Option(content).innerHTML, markedOptions)
: marked.parse(new Option(content).innerHTML, markedOptions);

if (parseEmoji) {
// We are using the old emoji parser here. This could come
// with additional processing use, but is the workaround available right now.
Expand Down
Loading