chore: support typst backend for docs#395
Open
Al3cLee wants to merge 1 commit intoQuantumKitHub:mainfrom
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is changed?
This PR:
docs/src/markdown files fromhtmlblocks to the markdown syntax, so that theDocumenterTypst.jlpackage can include the images correctly, anddocs/make.jlwhich builds the PDF through typst.Using relative paths is necessary
This PR didn’t change image file paths. However, in future writing of the documentations, please note that absolute paths are not supported by
DocumenterTypst.jl!How to tune image width?
The markdown syntax does not control image width, so in some cases the output image can take up very much space, even the whole page, which you might not want. I'm not sure whether hard-wiring size information into the svg will work, and if all other methods don't work, one can still inspect the generated
.typfile according to the docs of DocumenterTypst.jl and then modify image width.To be specific, if we generate
.typoutput as instructed by the docs, thedocs/builddirectory will be populated with 2 additional files:documenter.typandTensorKit.typwhere the former is a utility template helper, and the latter is a long file which#importsdocumenter.typand can render to a PDF.Using the typst previewer, the preview of
TensorKit.typcan take a long time to load, and the preview itself is laggy. So instead of scrolling through the preview for images, one can simply search forimageinTensorKit.typ(they are wrapped in#figureenvironments, so search forimageinstead of#image) and tune thewidthparameter to something other than the default100%.Possible dark-theme issue in html output
The statement
class="color-invertible"will also be absent in the markdown syntax, causing vector graphics to no longer be inverted in dark themes. I've confirmed this behavior on my localhost. Thehtmlsyntax is not supported by the typst backend currently.To resolve this, it is indeed possible to dedicate a branch to the typst build, while the main branch is still the color-invertible-graphics
htmlbuild, but that would mean you guys need to take care of both branches of the docs.