weasel API - v0.8.0
    Preparing search index...

    Function embedWeaselMetadataInSvg

    • Embed a weasel clipboard payload in an SVG document as a <metadata> child of the root — legal SVG 1.1, ignored by external tools — so one text/plain flavor serves both audiences: external tools parse the SVG, weasel extracts the JSON for full fidelity on draw→draw DOM paste.

      The payload rides in CDATA so JSON's < / & need no entity escaping; a literal ]]> inside the payload is split across CDATA sections (]]]]><![CDATA[>), which extractWeaselClipboardFromSvg rejoins.

      Intended for OUR serializer's output only (serializeSvg — single <svg ...> open tag, XML-escaped attributes). When no open tag is found the input is returned unchanged with a debug warning.

      Parameters

      • svgText: string
      • payloadText: string

      Returns string