Skip to content

Embedding of custom icons via 'use' element prevents working with complex SVG #727

Open
@gwynne

Description

@gwynne

Description

When a custom icon for a given ID (such as technology) is set in theme-settings.json, the icon is embedded in the rendered page via SVG's <use/> element. This runs afoul of WebKit bugs which prevent non-trivial SVGs from rendering properly when embedded this way.

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected Behavior

I expect using a custom icon to allow for the full range of SVG features.

Actual behavior

As the custom icon is embedded via <use/> instead of being referenced directly or embedded verbatim, various WebKit bugs (see below) prevent using even "basic" SVG features like <linearGradient> or embedded <style>.

https://bugs.webkit.org/show_bug.cgi?id=258225
https://bugs.webkit.org/show_bug.cgi?id=65344
https://bugs.webkit.org/show_bug.cgi?id=104169
https://bugs.webkit.org/show_bug.cgi?id=179724
https://bugs.chromium.org/p/chromium/issues/detail?id=109212

Steps To Reproduce

  1. Visit https://api.vapor.codes/sqlitenio/documentation/sqlitenio/
  2. Compare to the actual SVG.
  3. Notice that the stroke gradient on the top "leaf" shape is only applied when accessing the SVG directly.

(Note: Numerous variations, such as using <defs>, <g>, etc. were tried; none worked.)

Swift-DocC-Render Version Information

c142759

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions