Skip to content

SCIX-819 fix(abstract): prevent truncation of math-heavy abstracts#780

Merged
thostetler merged 9 commits intoadsabs:masterfrom
thostetler:SCIX-819
Jan 28, 2026
Merged

SCIX-819 fix(abstract): prevent truncation of math-heavy abstracts#780
thostetler merged 9 commits intoadsabs:masterfrom
thostetler:SCIX-819

Conversation

@thostetler
Copy link
Member

Abstracts containing LaTeX math notation like $10<z_\mathrm{phot}<12$ were being
truncated because the browser HTML parser interpreted < and > inside math
delimiters as HTML tags, corrupting the DOM.

  • Add escapeMathHtml utility to escape < and > inside $...$ and $$...$$ delimiters
  • Create SafeAbstract component with ErrorBoundary fallback for graceful degradation
  • Update abstract page and search result previews to use SafeAbstract
  • Add unit and integration tests including the real problematic abstract

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 95.94595% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.1%. Comparing base (e5ef845) to head (d4b47b4).

Files with missing lines Patch % Lines
src/utils/abstract/escape-math-html.ts 90.0% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #780     +/-   ##
========================================
+ Coverage    61.0%   61.1%   +0.1%     
========================================
  Files         302     304      +2     
  Lines       35244   35318     +74     
  Branches     1528    1533      +5     
========================================
+ Hits        21494   21563     +69     
- Misses      13714   13719      +5     
  Partials       36      36             
Files with missing lines Coverage Δ
src/components/SafeAbstract/SafeAbstract.tsx 100.0% <100.0%> (ø)
src/utils/abstract/escape-math-html.ts 90.0% <90.0%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thostetler thostetler force-pushed the SCIX-819 branch 2 times, most recently from d48558c to 03ec5a2 Compare January 23, 2026 22:01
@thostetler thostetler requested a review from shinyichen January 23, 2026 22:01
@thostetler thostetler marked this pull request as ready for review January 23, 2026 22:01
…iters

Prevents browser HTML parser from interpreting < and > characters
inside LaTeX math notation as HTML tags, which caused abstract
truncation on papers with complex math.
Component pre-processes math to escape HTML characters and wraps
MathJax rendering in an error boundary. Falls back to plain text
display if rendering fails.
Replaces direct MathJax usage with SafeAbstract component that
handles HTML escaping and error fallbacks.
Applies same safe rendering to search result abstract previews.
…bstract

Verifies the fix works for the specific abstract that caused the
original truncation bug.
@thostetler thostetler merged commit f41136e into adsabs:master Jan 28, 2026
5 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.

2 participants