Skip to content
Merged
Changes from 1 commit
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
9 changes: 6 additions & 3 deletions app/composables/useMarkdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ function stripAndEscapeHtml(text: string, packageName?: string): string {
// Then strip markdown image badges
stripped = stripMarkdownImages(stripped)

// Then strip actual HTML tags (keep their text content)
// Only match tags that start with a letter or / (to avoid matching things like "a < b > c")
stripped = stripped.replace(/<\/?[a-z][^>]*>/gi, '')
// Strip actual HTML tags (keep their text content), but leave tags inside backtick spans
// The alternation matches a backtick span first — if that branch wins the match is kept as-is
stripped = stripped.replace(
/(`[^`]*`)|<\/?[a-z][^>]*>/gi,
(match, codeSpan: string | undefined) => codeSpan ?? '',
)

// Strip HTML comments: <!-- ... --> (including unclosed comments from truncation)
stripped = stripped.replace(/<!--[\s\S]*?(-->|$)/g, '')
Expand Down
Loading