Skip to content

chore: include katex fonts in resources - #9673

Closed
AllanChain wants to merge 1 commit into
logseq:masterfrom
AllanChain:include-katex-font
Closed

AllanChain wants to merge 1 commit into
logseq:masterfrom
AllanChain:include-katex-font

Conversation

@AllanChain

Copy link
Copy Markdown
Contributor

The KaTeX fonts are not included in the resources and are fetched for jsdelivr for some (unknown and historical) reasons. But jsdelivr is not quite stable in some regions and loading the font from the Internet can have some problems when offline.

I downloaded the fonts from the KaTeX GitHub release and kept only the woff2 fonts. I also updated the font URL.

@logseq-cldwalker

Copy link
Copy Markdown
Collaborator

@AllanChain Hi. Unfortunately this isn't helpful to us as these are a large number of unverified resources and that puts our users at risk. If we are to bring a large number of resources like this, it would need to be automated and come from an official distributor. I've added a note about this in number 7 under https://github.com/logseq/logseq/blob/master/CONTRIBUTING.md#pr-guidelines. At some point we may introduce a proxy CDN for resources like this to ensure more stability in regions

@AllanChain

Copy link
Copy Markdown
Contributor Author

However, it's very easy to verify the resource.

In logseq repo:

cd resources/fonts/katex
sha256sum *

In a temp dir:

wget https://github.com/KaTeX/KaTeX/releases/download/v0.16.7/katex.zip
cd katex/fonts
sha256sum *.woff2

Also, a proxy CDN is not an optimal choice. It costs money and it's not helpful for the future growth of logseq. We can just add an extra build step to download the resources from GitHub / NPM.

Currently, KaTeX fonts are the only resource that rely on jsdelivr. If you do think jsdelivr stability is a problem, including the fonts is the best way to fix it for now.

@cnrpman

cnrpman commented Jun 16, 2023

Copy link
Copy Markdown
Collaborator

@AllanChain I'm okay if can setup a pipeline to validate the sha256sum from official source instead of just putting the static resource

If we are to bring a large number of resources like this, it would need to be automated

@logseq-cldwalker

Copy link
Copy Markdown
Collaborator

@AllanChain Like @cnrpman said, if you can have these resources integrated into our build process through, gulp, npm and/or shadow-cljs, then we are open to the change. Just copying and pasting this many resources is needless risk and a maintenance burden for us

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.

3 participants