MCPcopy Index your code
hub / github.com/simstudioai/sim / markdownToPlainText

Function markdownToPlainText

apps/sim/connectors/linear/linear.ts:16–32  ·  view source on GitHub ↗

* Strips Markdown formatting to produce plain text.

(md: string)

Source from the content-addressed store, hash-verified

14 * Strips Markdown formatting to produce plain text.
15 */
16function markdownToPlainText(md: string): string {
17 let text = md
18 .replace(/!\[.*?\]\(.*?\)/g, '') // images
19 .replace(/\[([^\]]*)\]\(.*?\)/g, '$1') // links
20 .replace(/#{1,6}\s+/g, '') // headings
21 .replace(/(\*\*|__)(.*?)\1/g, '$2') // bold
22 .replace(/(\*|_)(.*?)\1/g, '$2') // italic
23 .replace(/~~(.*?)~~/g, '$1') // strikethrough
24 .replace(/`{3}[\s\S]*?`{3}/g, '') // code blocks
25 .replace(/`([^`]*)`/g, '$1') // inline code
26 .replace(/^\s*[-*+]\s+/gm, '') // list items
27 .replace(/^\s*\d+\.\s+/gm, '') // ordered list items
28 .replace(/^\s*>\s+/gm, '') // blockquotes
29 .replace(/---+/g, '') // horizontal rules
30 text = text.replace(/\s+/g, ' ').trim()
31 return text
32}
33
34/**
35 * Executes a GraphQL query against the Linear API.

Callers 1

buildIssueContentFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected