docs: render CairoMakie figures as SVG, like Plots - #933
Merged
Conversation
Phase K added the first Makie page (examples/logo.md) but its figures came out as raster PNG: DocumenterVitepress ranks image/png (4.0) above image/svg+xml (3.0), and CairoMakie — contrary to the note in Handbook/VITEPRESS-DOC.md — responds to both MIME types, so PNG won. Fixed the same way as Plots (#903): disable PNG capture globally in make.jl so DocumenterVitepress falls back to SVG. - `import CairoMakie`, not `using`: `using` would pull Makie's `plot` / `plot!` into Main, where they collide with Plots' and break the `@docs` block on results/plot.md (`undefined binding 'plot!'`). - `CairoMakie.activate!(; type="svg")` + `Base.showable(::MIME"image/png", ::CairoMakie.Makie.Figure) = false`. Verified: full build exit 0, 0 unresolved @ref, all 50 built figures are now .svg (the logo page's three included). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ocots
added a commit
to control-toolbox/Handbook
that referenced
this pull request
Sep 1, 2026
Current CairoMakie (0.15) responds to `image/png` just like Plots, so DocumenterVitepress picks PNG for Makie figures too — the "produces SVG automatically, no action needed" note was wrong. Give the same global `Base.showable` fix for both, and the `import CairoMakie` (not `using`) caveat that avoids a `plot!` collision in `@docs` blocks. Found while rendering OptimalControl.jl's logo page (control-toolbox/OptimalControl.jl#933). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Phase K (#921) added the first Makie page —
examples/logo.md— but its three figures render as raster PNG. DocumenterVitepress ranksimage/png(4.0) aboveimage/svg+xml(3.0), and CairoMakie — contrary to the note inHandbook/VITEPRESS-DOC.md("CairoMakie … No action needed") — responds to both MIME types, so PNG wins.Fixed the same way as Plots (#903): disable PNG capture globally in
make.jl.Why
import, notusing:using CairoMakiepulls Makie'splot/plot!intoMain, where they collide with Plots' — the@docsblock onresults/plot.mdthen fails withundefined binding 'plot!'and terminates the build.importkeeps the extension-loading (soMakie.plot(sol)still works on the logo page) without the namespace pollution.Verification
Full
julia --project=. docs/make.jl: exit 0, 0Cannot resolve @ref, nodocs_blockerror. All 50 built figures are now.svg(the logo page's three included). Only remaining build errors are the 4 unchanged Phase-D@extrefitems.Companion
Handbook/VITEPRESS-DOC.md's "Plot image format" bullet still says CairoMakie needs no action — corrected in Handbook#18.Add the
run documentationlabel to build the site in CI.🤖 Generated with Claude Code