| 21 | } |
| 22 | |
| 23 | function parseGitHubRepos(markdown) { |
| 24 | const regex = /\(https:\/\/github\.com\/([^\s/)]+)\/([^\s/)]+)(?:\/[^)]*)?\)/g; |
| 25 | const repos = new Map(); |
| 26 | |
| 27 | for (const match of markdown.matchAll(regex)) { |
| 28 | const { owner, repo } = normalizeRepo(match[1], match[2]); |
| 29 | const slug = `${owner}/${repo}`; |
| 30 | |
| 31 | if (!repos.has(slug)) { |
| 32 | repos.set(slug, { |
| 33 | owner, |
| 34 | repo, |
| 35 | slug, |
| 36 | url: `https://github.com/${slug}`, |
| 37 | }); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | return repos; |
| 42 | } |
| 43 | |
| 44 | function extractCommunitySection(readme) { |
| 45 | const start = readme.indexOf(COMMUNITY_HEADER); |