Skip to content

fix(ingest): skip reference-style badges and badge URLs with parentheses - #18

Merged
simonvanlierde merged 1 commit into
mainfrom
fix/excerpt-reference-badges
Oct 27, 2026
Merged

simonvanlierde merged 1 commit into
mainfrom
fix/excerpt-reference-badges

Conversation

@simonvanlierde

Copy link
Copy Markdown
Contributor

Two badge cases still ended up in a project's summary after #17.

  • Reference-style badge rows like [![CI][ci-badge]][ci] ![Cov][cov] weren't recognised. They are now, and so are their [ci-badge]: https://… definition lines; without that, a definition line became the summary once the badge row was skipped. A link inside a sentence, like See [a][b] for more., stays.
  • A badge URL with parentheses, like https://x/w_(a).svg, didn't match. URLs may now hold one level of parentheses.
  • Brackets still stay out of alt text, labels and URLs, so every match attempt stops at the next bracket and matching stays linear. Crafted 100,000-character lines take under 1 ms.

Tests: the reference-badge test failed before the fix, with the badge row as the summary. A new test runs CodeQL's earlier backtracking input and three other crafted lines, each under 100 ms. npm run check && npm run lint && npm test && npm run build exits 0 (24 tests). URLs with nested parentheses, like a_(b_(c)), are still not recognised.

- Badge rows like `[![CI][ci-badge]][ci]` and their `[label]: url` definition lines no longer end up in the summary.
- Badge URLs may contain one level of parentheses. Brackets stay out of alt text, labels and URLs, so matching stays linear.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@simonvanlierde
simonvanlierde merged commit 9e4de38 into main Oct 27, 2026
4 checks passed
@simonvanlierde
simonvanlierde deleted the fix/excerpt-reference-badges branch October 27, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants