MCPcopy Create free account
hub / github.com/danielpetho/fancy / extractTableCells

Function extractTableCells

src/scripts/build-docs-markdown.ts:332–348  ·  view source on GitHub ↗
(content: string, cellType: string)

Source from the content-addressed store, hash-verified

330}
331
332function extractTableCells(content: string, cellType: string): string[] {
333 const cellRegex = new RegExp(`<${cellType}[^>]*>([\\s\\S]*?)<\\/${cellType}>`, 'g')
334 const cells: string[] = []
335 let match
336
337 while ((match = cellRegex.exec(content)) !== null) {
338 // Clean the cell content
339 let cellContent = match[1]
340 .replace(/<[^>]*>/g, '') // Remove HTML tags
341 .replace(/\s+/g, ' ') // Normalize whitespace
342 .trim()
343
344 cells.push(cellContent)
345 }
346
347 return cells
348}
349
350function extractTableRows(content: string): string[][] {
351 const rowRegex = /<TableRow[^>]*>([\s\S]*?)<\/TableRow>/g

Callers 2

convertTablesToMarkdownFunction · 0.85
extractTableRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected