Documentation
Ferrite.asset_url — Function
asset_url(file::AbstractString)Get the url for the asset file. Please note that no promises are made that files that currently exists will be kept. This function is only used to facilitate downloading assets for tutorials etc, allowing a centrally administrated locations for all assets.
Only Ferrite maintainers can add assets, which are added by directly uploading to the assets folder in the gh-pages branch.
Example figures and animations
The figures and animations shown on the tutorials and code gallery overview pages, in the how-to guides, and at the top of each example, are rendered with ParaView from the VTK files that the examples themselves write. They come in light/dark pairs (<name>-light.png / <name>-dark.png, or .webp animations for time-stepping examples) and docs/src/assets/custom.css displays the variant matching the active Documenter theme.
The pipeline consists of the following pieces:
docs/generate_screenshots.jlruns each example registered in itsEXAMPLESdictionary, collecting its.vtu/.pvd/.vtkhdfoutput indocs/screenshot-data/(gitignored), and then invokespvbatchondocs/screenshots.py.docs/screenshots.pycontains one small ParaView scene per example and renders the light/dark pair for each intodocs/screenshot-assets/(gitignored). Static scenes are saved withfinish(...)(PNG) and time series withfinish_anim(...)(animated WebP, requires ImageMagick'smagickorconvertonPATH).- The rendered files are not committed to the main branch. They are uploaded to the
assets/directory on thegh-pagesbranch (pass--uploadtogenerate_screenshots.jl), from wheredocs/download_resources.jlfetches them during the docs build. When previewing locally,download_resources.jlprefers freshly rendered files indocs/screenshot-assets/over downloading, so no upload is needed. docs/generate.jl(write_overview) composes the overview pages from the curated descriptions indocs/tutorials_index_body.mdanddocs/gallery_index_body.md: each----separated description section is paired, in order, with an entry in thecardslists and rendered as a row with the figure to the left of the description.
Adding a figure for a new example
- Make sure the example writes its result to a VTK file (
VTKGridFile), or, for an animation, a temporalVTKHDFGridFile(or aWriteVTK.paraview_collectionwith one file per time step). This output is what the figure is rendered from. If the figure needs data the example does not write by default — a second parameter set to compare against, a finer mesh — put that extra call in thePOSTRUNdictionary instead of making the example itself slower for every docs build. - Register the example in the
EXAMPLESdictionary indocs/generate_screenshots.jl, mapping a screenshot name to the literate source file. - Add a scene for it in
docs/screenshots.py(copying a similar existing scene is the easiest way; usefinishfor a static PNG andfinish_animfor an animation). Anything drawn on top of the data rather than coloured by it — glyphs, a marked-up cut line — should go throughannotate, so its colour flips with the variant instead of disappearing into one of the two backgrounds. A scene that renders more than one figure also needs anOUTPUTSentry indocs/generate_screenshots.jllisting its file basenames. - Render it with
julia --project=docs docs/generate_screenshots.jl <name>(requirespvbatchonPATH, andmatplotlibimportable by it —screenshots.pysays how if it isn't). While tuning the scene, add--render-onlyto reuse the data files from the previous run. Check the result indocs/screenshot-assets/. - Register the generated file names in
docs/download_resources.jlso that CI (and other machines) fetch them when building the docs. - Show the figure at the top of the example by adding an
# /# pair after the title in the literate source file (see e.g.docs/src/literate-tutorials/heat_equation.jl). - For a tutorial or gallery example, add it to the overview page: an entry in the corresponding
cardslist indocs/generate.jland a----separated description section indocs/tutorials_index_body.mdordocs/gallery_index_body.md. The cards and the description sections are paired in order, so put both in the same position (the build errors if the counts don't match). - Verify with a local docs build (
julia --project=docs docs/make.jl), which picks up the assets fromdocs/screenshot-assets/. - Once happy, upload the assets to
gh-pageswithjulia --project=docs docs/generate_screenshots.jl --render-only <name> --upload(requires push rights to the repository).
The Documenter CI job also runs every scene in --check mode. It reuses the VTK output from notebook execution, renders at reduced resolution with only a few animation frames, and never uploads those smoke-test assets.
Illustrations in the topic guides
The drawn figures — reference shape numbering, grid numbering, the geometric mapping, and Dirichlet vs ProjectedDirichlet — are generated by docs/diagrams.jl, which writes a light/dark SVG pair per figure into docs/src/topics/assets/. It is plain Julia emitting SVG, with no dependencies, and one geometry definition per figure shared by both color themes so the two variants cannot drift apart.
Unlike the example figures these are small enough to commit, so they live in the repository and only need regenerating when a figure changes, with julia docs/diagrams.jl docs/src/topics/assets.
Prefer explaining notation in the page over lettering it into the figure: text in the markdown is selectable, searchable, and typeset by KaTeX, and it does not need a second color variant.