MCPcopy Index your code
hub / github.com/npmx-dev/npmx.dev / stripMarkdownImages

Function stripMarkdownImages

app/composables/useMarkdown.ts:33–42  ·  view source on GitHub ↗

* Strip markdown image badges from text. * Each pass removes image atoms, empty link wrappers, and reference defs. * Re-run to a fixed point so nested shapes like `[![…][ref]][ref]` collapse * without per-shape rules.

(text: string)

Source from the content-addressed store, hash-verified

31 * without per-shape rules.
32 */
33function stripMarkdownImages(text: string): string {
34 let previous: string
35 do {
36 previous = text
37 for (const pattern of STRIPPABLE_MARKDOWN) {
38 text = text.replace(pattern, '')
39 }
40 } while (text !== previous)
41 return text.trim()
42}
43
44// Strip HTML tags and escape remaining HTML to prevent XSS
45function stripAndEscapeHtml(text: string): string {

Callers 1

stripAndEscapeHtmlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected