Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bbbert
Copy link
Contributor

@bbbert bbbert commented Jan 3, 2025

Fixes #582, and likely #434 too, but I'm not sure about the latter.

The issue comes from an incorrect line count calculation which either counts the number of child nodes of the root of the AST or the number of newlines in the first node if it is the only node and it is text. This works for parsers that happen to output one root-child node per line, but not for others. What we want is the number of newlines in the whole text. There is also an off-by-one in the original calculation for the largest line number.

before
after

Copy link

codecov bot commented Jan 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.02%. Comparing base (842b45b) to head (2e8c7cb).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #583      +/-   ##
==========================================
- Coverage   96.04%   96.02%   -0.03%     
==========================================
  Files          11       11              
  Lines         329      327       -2     
  Branches      130      130              
==========================================
- Hits          316      314       -2     
  Misses         12       12              
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@khashashin
Copy link

I hope this will be merged soon

@simmerer simmerer merged commit cc20d1e into react-syntax-highlighter:master Aug 21, 2025
3 checks passed
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.

Line number min-width too small
3 participants