Skip to content

Commit

Permalink
Revert "fix: Inconsistent Markdown Formatting in Custom Status Field" (
Browse files Browse the repository at this point in the history
  • Loading branch information
csuadev authored and abhinavkrin committed Oct 25, 2024
1 parent 19c3c51 commit b858b3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
5 changes: 0 additions & 5 deletions .changeset/kind-drinks-joke.md

This file was deleted.

18 changes: 7 additions & 11 deletions apps/meteor/client/components/MarkdownText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,16 @@ 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 @@ -117,6 +112,7 @@ 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

0 comments on commit b858b3a

Please sign in to comment.