Skip to content
Snippets Groups Projects
Unverified Commit 9bc12da2 authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

fix(markdown): don't remove char before `#` (#23151)

parent 4b2f4abc
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ import { regEx } from './regex'; ...@@ -6,7 +6,7 @@ import { regEx } from './regex';
export function sanitizeMarkdown(markdown: string): string { export function sanitizeMarkdown(markdown: string): string {
let res = markdown; let res = markdown;
// Put a zero width space after every # followed by a digit // Put a zero width space after every # followed by a digit
res = res.replace(regEx(/\W#(\d)/gi), '#​$1'); res = res.replace(regEx(/(\W)#(\d)/gi), '$1#​$2');
// Put a zero width space after every @ symbol to prevent unintended hyperlinking // Put a zero width space after every @ symbol to prevent unintended hyperlinking
res = res.replace(regEx(/@/g), '@​'); res = res.replace(regEx(/@/g), '@​');
res = res.replace(regEx(/(`\[?@)​/g), '$1'); res = res.replace(regEx(/(`\[?@)​/g), '$1');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment