Skip to content

Commit

Permalink
feat: add 'maidr' attribute to SVG elements for enhanced metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
dakshpokar committed Feb 20, 2025
1 parent 27f96fc commit 66581d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion maidr/core/maidr.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def _get_svg(self) -> HTML:
for element in tree_svg.iter(tag="{http://www.w3.org/2000/svg}svg"):
if "id" not in element.attrib:
element.attrib["id"] = Maidr._unique_id()
if "maidr" not in element.attrib:
element.attrib["maidr"] = json.dumps(self._flatten_maidr(), indent=2)
root_svg = element
self._set_maidr_id(element.attrib["id"])
break
Expand Down Expand Up @@ -186,7 +188,6 @@ def _inject_plot(plot: HTML, maidr: str) -> Tag:
tags.body(
tags.div(plot),
),
tags.script(maidr),
)

def generate_iframe_script(unique_id: str) -> str:
Expand Down

0 comments on commit 66581d3

Please sign in to comment.