(section: string, category: string)
| 47 | } |
| 48 | |
| 49 | function parseMarkdownTable(section: string, category: string): ParsedExtension[] { |
| 50 | const extensions: ParsedExtension[] = [] |
| 51 | |
| 52 | // Split into lines and process each table row |
| 53 | const lines = section.split("\n") |
| 54 | |
| 55 | for (const line of lines) { |
| 56 | // Skip non-table lines |
| 57 | if (!line.startsWith("|")) continue |
| 58 | // Skip header and separator rows |
| 59 | if (line.includes("|---|") || line.match(/\|Name\|Stars\|Description\|/i)) continue |
| 60 | |
| 61 | // Match: |[Name](url)|stars badge or -|Description| |
| 62 | const match = line.match(/^\|\[([^\]]+)\]\(([^)]+)\)\|[^|]*\|([^|]+)\|?$/) |
| 63 | if (!match) continue |
| 64 | |
| 65 | const [, name, url, description] = match |
| 66 | |
| 67 | // Skip if it's just a header row or empty |
| 68 | if (!name || !url || name === "Name") continue |
| 69 | |
| 70 | const extension: ParsedExtension = { |
| 71 | name: name.trim(), |
| 72 | url: url.trim(), |
| 73 | description: description.trim(), |
| 74 | category, |
| 75 | } |
| 76 | |
| 77 | const githubInfo = extractGitHubInfo(url) |
| 78 | if (githubInfo) { |
| 79 | extension.repoOwner = githubInfo.owner |
| 80 | extension.repoName = githubInfo.repo |
| 81 | } |
| 82 | |
| 83 | extensions.push(extension) |
| 84 | } |
| 85 | |
| 86 | return extensions |
| 87 | } |
| 88 | |
| 89 | function parseReadme(content: string): ParsedExtension[] { |
| 90 | const allExtensions: ParsedExtension[] = [] |
no test coverage detected