g_validate
Validates, sanitizes and normalizes SVG icons: checks XML well-formedness, blocks scripts and event handlers, adds missing xmlns and viewBox, then injects color and size to return clean usable markup.
Instructions
Validate, sanitize and normalize an AI-generated (or any hand-written) SVG icon: XML well-formedness, security filter (rejects /event handlers//javascript:), adds missing xmlns/viewBox, injects color/size. Returns the cleaned SVG ready for use, plus warnings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| svg | Yes | The SVG markup to validate, root element must be <svg> | |
| size | No | Output size in px, e.g. 32. Injected as width/height | |
| color | No | Color to apply, e.g. "#333333". Replaces currentColor; injects fill if none present |