Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions packages/formatters/__tests__/escapers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const testURLs = [
'https://example.com/name_with_underscores',
'https://example.com/name__with__underscores',
'https://example.com/name_with_underscores_and__double__underscores',
'https://*.example.com/globbed/*',
];

describe('Markdown escapers', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/formatters/src/escapers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export function escapeInlineCode(text: string): string {
*/
export function escapeItalic(text: string): string {
let idx = 0;
const newText = text.replaceAll(/(?<=^|[^*])\*([^*]|\*\*|$)/g, (_, match) => {
const newText = text.replaceAll(/(?<=^|[^*])(?<!https?:\/\/\S*)\*([^*]|\*\*|$)/g, (_, match) => {
if (match === '**') return ++idx % 2 ? `\\*${match}` : `${match}\\*`;
return `\\*${match}`;
});
Expand Down