astro-ghostcms/.pnpm-store/v3/files/83/7332d4b9b38fc3fa2c003f89356...

21 lines
548 B
Plaintext

import { encodeSVGforURL } from './url.mjs';
function encodeSvgForCss(svg) {
let useSvg = svg.startsWith("<svg>") ? svg.replace("<svg>", "<svg >") : svg;
if (!useSvg.includes(" xmlns:xlink=") && useSvg.includes(" xlink:")) {
useSvg = useSvg.replace(
"<svg ",
'<svg xmlns:xlink="http://www.w3.org/1999/xlink" '
);
}
if (!useSvg.includes(" xmlns=")) {
useSvg = useSvg.replace(
"<svg ",
'<svg xmlns="http://www.w3.org/2000/svg" '
);
}
return encodeSVGforURL(useSvg);
}
export { encodeSvgForCss };