Embedding a note which contains an inline SVG

Things I have tried

I’m trying to embed a note (let’s call it noteA) in another note (let’s call it noteB). Like this

![[noteA]]

It’s just that noteA contains an inline SVG. This SVG renders perfectly fine when I open the noteA. But when I open noteB, instead of rendering the SVG, Obsidian shows its source (HTML/XML tags).

I’ve tried other tags (e.g. HTML’s font) but they render perfectly fine when embedded.

What I’m trying to do

Embed a note when it holds an inline SVG.

I’m not sure if this is a bug, a missing feature, or if I’m doing something wrong.

Your input is very much appreciated.

Well, that’s embarrassing! I just learned what the problem was. Perhaps, it can help someone later.

After trying different SVG tags, I realized the problem was with the way the tags were typed. For instance, this one worked just fine:

<svg height="210" width="500">
<polygon points="200,10 250,190 160,210" style="fill:lime;stroke:purple;stroke-width:1" />
</svg>

While my own which was much larger failed. That was because the opening tag of SVG had newlines in it. This is the one that fails to render after being embedded:

<svg
   width="56.979057mm"
   height="56.294029mm"
   viewBox="0 0 56.979057 56.294029"
   version="1.1"
   id="svg5"
   inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
   sodipodi:docname="precision_recall.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
...

As you can see, the opening tag for SVG is spread across multiple lines and when embedded, it will not render.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.