From 7bfa4f9d768a9df249ba130e7b9c832bf7a06fc9 Mon Sep 17 00:00:00 2001 From: Olivier Cots Date: Wed, 2 Sep 2026 00:07:38 +0200 Subject: [PATCH] docs: use qualified using for CairoMakie to satisfy meta no-import test The SVG plotting setup merged in #550 used `import CairoMakie`, which trips the `test_no_import` regression guard (Handbook tenet 2: using, never import). Use `using CairoMakie: CairoMakie, Makie` instead: it loads CairoMakie, keeps Makie's `plot`/`plot!` out of Main (no clash with Plots in `@docs` blocks), and still enables the SVG backend / disables PNG output. --- docs/make.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index dfcef941..3dfa6fff 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -19,8 +19,15 @@ using Test using Coverage using DifferentiationInterface using Plots -import CairoMakie +using CairoMakie: CairoMakie, Makie # qualified `using`: loads CairoMakie and exposes + # CairoMakie/Makie without importing Makie's `plot`/`plot!` + # into Main (avoids clashing with Plots in `@docs` blocks). +# DocumenterVitepress picks the highest-priority MIME type a plot object responds to +# (image/png: 4.0 over image/svg+xml: 3.0) — the opposite of Documenter.HTML, which +# prefers SVG. Both Plots.jl and CairoMakie respond to `image/png`, so PNG wins for +# every figure unless it is disabled. Set once here so it covers every page, present +# or future. See Handbook/VITEPRESS-DOC.md "Plot image format — SVG vs PNG". Base.showable(::MIME"image/png", ::Plots.Plot) = false CairoMakie.activate!(; type="svg") Base.showable(::MIME"image/png", ::CairoMakie.Makie.Figure) = false