-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use URI-encoding for SVG images coming from at-example blocks #1537
Comments
Hmm. In principle, for the layout part, it should be sufficient to make sure that we apply the same CSS to the Documenter.jl/src/Writers/HTMLWriter.jl Lines 1750 to 1759 in 80a86d7
|
@example
blocks better
That sadly doesn't help, because svgs don't respect css width/height settings if they have a viewBox attribute. https://css-tricks.com/scale-svg/ |
If a bitmap plot is returned, it's wrapped in an image tag. If an svg plot is returned, it's not wrapped, which means the svg often will just spill over the column layout, because svg just enforces its own dimensions ruthlessly. I recently made a PR in VSCode about the same issue, which we could use in Documenter as well https://github.com/julia-vscode/julia-vscode/blob/953304c5d00ae68eb33e337110509ca6d63c1152/src/interactive/plots.ts#L139-L162
It involves URI encoding the svg string and then using it as the src for an
img
tag. This could also fix issues such as Cairo-produced svg's invalidating each other such as described here https://discourse.julialang.org/t/cairomakie-and-fontconfig/55931/13?u=julesThe text was updated successfully, but these errors were encountered: