Skip to content

TOC highlighting refactor and robustness fixes#2443

Merged
stanislaw merged 15 commits intomainfrom
mettta/TOC_highlighting_ref
Mar 5, 2026
Merged

TOC highlighting refactor and robustness fixes#2443
stanislaw merged 15 commits intomainfrom
mettta/TOC_highlighting_ref

Conversation

@mettta
Copy link
Copy Markdown
Collaborator

@mettta mettta commented Aug 28, 2025

  • Simplified and cleaned guards: removed redundant checks, unified coordinate comparisons in IntersectionObserver, simplified hash extraction.
  • Robustness improvements: added viewport fallback for rootBounds=null, replaced silent guards with console.assert and moved checks to call sites.
  • Efficient re-scan: introduced anchorsCount/anchorsSig to detect TOC mutations and skip unnecessary re-observe, while keeping mapping valid after resetState().
  • Removed legacy code: dropped unused contentFrameTop metric and clarified inline comments.
  • Hash remapping: implemented resolveMovedFragment() to transparently remap outdated hashes when TOC entries are reordered and renumbered.

@mettta mettta requested a review from stanislaw August 28, 2025 06:16
Comment thread strictdoc/export/html/_static/toc_highlighting.js Outdated
Comment thread strictdoc/export/html/_static/toc_highlighting.js Outdated
@stanislaw stanislaw modified the milestones: 2025-Q3, 2025-Q4 Sep 27, 2025
@stanislaw stanislaw modified the milestones: 2025-Q4, 2026-Q1 Jan 1, 2026
mettta added 15 commits March 4, 2026 20:45
…valid

- Introduced anchorsCount/anchorsSig to detect changes and avoid redundant re-observe.
- Rebuild anchor→data mapping after resetState() even if set unchanged.
- Guarded handleIntersect against missing mapping during TOC mutations.
…or text blocks without anchors), virtual viewport
@mettta mettta force-pushed the mettta/TOC_highlighting_ref branch from 47f9ef3 to 05a13d0 Compare March 5, 2026 00:11
@stanislaw stanislaw merged commit 698e101 into main Mar 5, 2026
34 checks passed
@stanislaw stanislaw deleted the mettta/TOC_highlighting_ref branch March 5, 2026 20:26
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