MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / extractElementContents

Function extractElementContents

sdk/src/tools/read-url.ts:132–137  ·  view source on GitHub ↗
(html: string, tagName: string)

Source from the content-addressed store, hash-verified

130}
131
132function extractElementContents(html: string, tagName: string): string[] {
133 const matches = html.matchAll(
134 new RegExp(`<${tagName}\\b[^>]*>([\\s\\S]*?)<\\/${tagName}>`, 'gi'),
135 )
136 return Array.from(matches, (match) => match[1]).filter(Boolean)
137}
138
139function selectReadableHtml(html: string): string {
140 const articleCandidates = extractElementContents(html, 'article')

Callers 1

selectReadableHtmlFunction · 0.85

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected