Skip to content

Lint: warn when {{ }} is placed directly inside <svg> or <math> #160

Open

Description

@JuroOravec

Problem

A {{ }} interpolation always inserts text. Placed directly inside an <svg> (or <math>), the text is escaped, so an author who passes SVG markup this way gets the markup shown as literal text instead of a drawing:

<svg viewBox="0 0 24 24">{{ icon_markup }}</svg>

The page then shows <path d="..."> as text, both in the server-rendered HTML and after Vue takes over, because Vue's own renderer escapes it the same way. Nothing reports the mistake: there is no hydration mismatch and no console warning.

Citry UI shipped this bug in five components during the Vue migration (fixed in #137): the accordion, disclosure and menu chevrons and the alert icon. Only the HTML validator in CI caught it.

Proposal

Report a {{ }} interpolation whose parent element is <svg>, <math> or another element inside them, where text is not allowed, as a citry check and editor finding. The message should say that the text is escaped and point to the fix: insert trusted markup as HTML, or render the SVG elements in the template.

Open questions

  • Severity: SVG allows text inside elements such as <text>, <tspan>, <title> and <desc>, so the rule must skip those. Elsewhere inside SVG, text is never drawn; is that an error or a warning?
  • Should the rule also cover Vue's v-text and {{ }} inside <math>?

Activity

  1. added
    next-sprint
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-sprint

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions