SVG Output

SVG output can optionally contain metadata for graphical objects (grobs) like note heads, rests, etc. This metadata can be standard SVG attributes like id and class, or non-standard custom attributes. Specify the attributes and their values by overriding a grob’s output-attributes property with a Scheme association list (alist). The values can be numbers, strings, or symbols. For example:

{
  \once \override NoteHead.output-attributes =
  #'((id . 123)
     (class . "this that")
     (data-whatever . something))
  c
}

The input above will produce the following <g> (group) tag in the SVG file:

<g id="123" class="this that" data-whatever="something">
  ...NoteHead grob SVG elements...
</g>

The <g> tag contains all of the SVG elements for a given grob. (Some grobs generate multiple SVG elements.) In SVG syntax the data- prefix is used for non-standard custom metadata attributes.

LilyPond Notation Reference v2.25.22 (development-branch).