Skip to content

fix: delay processing of KaTeX#778

Merged
david-christiansen merged 5 commits intomainfrom
katex-delay
Mar 2, 2026
Merged

fix: delay processing of KaTeX#778
david-christiansen merged 5 commits intomainfrom
katex-delay

Conversation

@david-christiansen
Copy link
Collaborator

This PR delays the processing of KaTeX until files are actually being generated, rather than adding its assets to the traverse state. This makes traversal faster and allows clients to completely opt out of deserializing it.

This PR delays the processing of KaTeX until files are actually being
generated, rather than adding its assets to the traverse state. This
makes traversal faster and allows clients to completely opt out of
deserializing it.
@david-christiansen david-christiansen added this pull request to the merge queue Mar 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Preview for this PR is ready! 🎉

Merged via the queue into main with commit 8fd45fa Mar 2, 2026
10 checks passed
@david-christiansen david-christiansen deleted the katex-delay branch March 2, 2026 09:05
Comment on lines +156 to +160
match features with
| ⟨true, true⟩ => #[.KaTeX, .search]
| ⟨true, false⟩ => #[.KaTeX]
| ⟨false, true⟩ => #[.search]
| ⟨false, false⟩ => #[]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is immediately regrettable as soon as there's a third thing. How about

Suggested change
match features with
| ⟨true, true⟩ => #[.KaTeX, .search]
| ⟨true, false⟩ => #[.KaTeX]
| ⟨false, true⟩ => #[.search]
| ⟨false, false⟩ => #[]
#[ if features.hasKatex then #[.KaTeX] else #[],
if features.hasSearch then #[.search] else #[], ].flatten

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better, probably: keep the pattern match ⟨isKatex, isSearch⟩ so that there's a type error when a feature gets added

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the thought process! Though if we start getting more features, we will want some other implementation of this, akin to what you're suggesting, and we can easily mitigate this risk by proving an appropriate lemma.

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