--- name: markdown-embedded-svg description: Use when authoring or editing a Markdown file that contains (or should contain) SVG diagrams, charts, or any graphical representation. Trigger whenever (1) writing a report/document/README in Markdown that needs a diagram, flowchart, chart, or other visual, (2) considering adding `` markup to a `.md` file, (3) editing existing SVG inside Markdown, (4) a user asks for a "diagram", "visual", "chart", or "flowchart" inside a Markdown document. Markdown renderers (GitHub, Gitea, Obsidian, VS Code preview) sanitize inline SVG very differently from each other — GitHub strips it entirely, Gitea allows only `` + ``, Obsidian (via DOMPurify) allows most of it. Apply this skill proactively before producing the SVG, not after. --- # SVG in Markdown Markdown renderers diverge dramatically on what SVG they allow. The safe default is **not** to embed SVG inline — it's to **save the SVG as a separate `.svg` file and reference it with image-link syntax**. Inline SVG should be treated as a special case the user explicitly asks for, not as the default. This skill encodes the reasoning behind that choice plus the per-renderer rules for when inline SVG is what's wanted. ## Default approach: external `.svg` file + image link For any new diagram going into a Markdown document: 1. Generate the SVG as a standalone `.svg` file. Common conventions: - `docs/images/.svg`, `assets/.svg`, or alongside the `.md` itself. - Match the project's existing convention if there is one. 2. Reference it from the Markdown with image-link syntax: ```markdown ![Architecture overview](./images/architecture.svg) ``` 3. The `.svg` file itself is a normal SVG document — `