Skip to content

docs: force SVG output for Plots-generated figures - #903

Merged
ocots merged 1 commit into
mainfrom
docs/svg-plots
Aug 30, 2026
Merged

ocots merged 1 commit into
mainfrom
docs/svg-plots

Conversation

@ocots

@ocots ocots commented Aug 30, 2026

Copy link
Copy Markdown
Member

What

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. CairoMakie isn't affected (its figures don't respond to image/png at all), but
Plots.jl responds to both, so PNG wins by default: every one of the 14 pages that
using Plots was rendering raster images instead of vector ones — a regression from the
Documenter → DocumenterVitepress migration that went unnoticed since nothing failed, the pages
just looked different.

Documented precisely in Handbook/VITEPRESS-DOC.md ("Plot image format — SVG vs PNG"), which
suggests a per-page Base.showable(::MIME"image/png", ::Plots.Plot) = false override. Applied
globally instead, once in docs/make.jl right where Plots is already loaded — Base.showable
is a method on the Plots.Plot type, so setting it before any @example block runs covers
every page that calls using Plots, present or future.

Verification

  • Rebuilt from scratch: every one of the 46 generated figures is now .svg. The only remaining
    .png in the build output is the pre-existing static rocket-def.png asset, untouched.
  • Full test suite unchanged: 2246 pass / 0 fail / 2 broken (docs/make.jl isn't loaded by
    Pkg.test()).

🤖 Generated with Claude Code

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. CairoMakie isn't affected (its figures
don't respond to image/png at all), but Plots.jl responds to both, so PNG
won by default: every one of the 14 pages that `using Plots` was rendering
raster images instead of vector ones, a regression from the Documenter →
DocumenterVitepress migration that went unnoticed since nothing failed —
the pages just looked different.

Documented precisely in Handbook/VITEPRESS-DOC.md ("Plot image format — SVG
vs PNG"), which suggests a per-page `Base.showable(::MIME"image/png",
::Plots.Plot) = false` override. Applied globally instead, once in
docs/make.jl right where Plots is already loaded: Base.showable is a method
on the Plots.Plot type, so setting it before any @example block runs covers
every page that calls `using Plots`, present or future, rather than needing
each new page to remember it.

Verified: rebuilt from scratch, every one of the 46 generated figures is now
.svg (previously counted at least 1 raster .png per Plots-using page); the
only remaining .png in the build output is the pre-existing static
rocket-def.png asset, untouched. Full test suite unchanged (2246 pass / 0
fail / 2 broken) — docs/make.jl isn't loaded by Pkg.test().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ocots ocots added the run documentation Trigger the Documentation workflow on this PR label Aug 30, 2026
@ocots
ocots merged commit 82be26a into main Aug 30, 2026
8 checks passed
@ocots
ocots deleted the docs/svg-plots branch August 30, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run documentation Trigger the Documentation workflow on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant