SVGs exported by editors such as Inkscape may contain sodipodi:* and/or
inkscape:* nodes/attributes. If these namespace prefixes appear without the
corresponding xmlns:* declarations, strict parsers (notably librsvg) can
fail with errors like:
Namespace prefix sodipodi on namedview is not definedThis helper removes non-rendering metadata blocks and attributes commonly responsible for parse failures, producing a more interoperable SVG string. It also removes Google Fonts @import rules which are not supported by rasterization engines.
sanitize_svg_for_raster(svg_input)A character string containing a sanitized SVG.
An SVG string or an object coercible to character
(e.g. htmltools::HTML).