Skip to content

feat(table-of-contents): cached data#3319

Merged
dolanmiu merged 10 commits intodolanmiu:masterfrom
Oak-Digital:feat/toc-cached
Feb 19, 2026
Merged

feat(table-of-contents): cached data#3319
dolanmiu merged 10 commits intodolanmiu:masterfrom
Oak-Digital:feat/toc-cached

Conversation

@Alexnortung
Copy link
Contributor

@Alexnortung Alexnortung commented Dec 12, 2025

This pull request is a draft as I would like some feedback for the direction.

I think it would be beneficial to be able to provide cached data for the table of contents, just like other fields.

Does the ToCEntry type make sense, should it be defined elsewhere? Or should it be something else entirely?

Does other properties also influence the output?

TODO:

  • Find the correct value for space left of each level
  • Find the correct value for the page width
  • Clean up
  • Add tests
  • Documentation

@Alexnortung Alexnortung force-pushed the feat/toc-cached branch 3 times, most recently from 1e6c09f to 7bb778c Compare December 12, 2025 10:13
@Alexnortung
Copy link
Contributor Author

For some reason, the level margin doesn't work as expected, not sure why

This commit can be squashed with the previous one if necessary
@Alexnortung Alexnortung marked this pull request as ready for review December 12, 2025 13:08
@Alexnortung
Copy link
Contributor Author

I am not sure why test is failing. I am pretty sure I am covering all code paths in the code that I have added.

Also what is wrong with the CSpell?

@dolanmiu
Copy link
Owner

Can you give me write permissions for this repo so I can fix the cspell, test and resolve conflicts?

@Alexnortung
Copy link
Contributor Author

I have tried to invite you, let me know if it worked

@dolanmiu dolanmiu self-requested a review February 18, 2026 16:20
Dolan Miu added 2 commits February 19, 2026 00:44
# Conflicts:
#	src/file/table-of-contents/table-of-contents.spec.ts
#	src/file/table-of-contents/table-of-contents.ts
@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6de8a8f) to head (d19a6b7).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3319   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          305       305           
  Lines         9435      9510   +75     
  Branches      1499      1517   +18     
=========================================
+ Hits          9435      9510   +75     

☔ 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.

@dolanmiu
Copy link
Owner

dolanmiu commented Feb 19, 2026

I have tried to invite you, let me know if it worked

All worked, thanks! Updated branch. Looks good. I will update the name of it. cachedContent (in a TableOfContents) is a bit verbose, maybe just cache @Alexnortung

@Alexnortung
Copy link
Contributor Author

regarding cachedContent I was trying to be consistent in regards to SimpleField which defines cachedValue.

I have renamed it to cachedEntries to allow for other elements such as a cached title.

@dolanmiu dolanmiu merged commit fb1d7aa into dolanmiu:master Feb 19, 2026
8 checks passed
@Alexnortung Alexnortung deleted the feat/toc-cached branch February 20, 2026 05:47
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