mikitex70 / plantuml-markdown

PlantUML plugin for Python-Markdown
BSD 2-Clause "Simplified" License
192 stars 55 forks source link

"svg_object" generates an invalid self-closing HTML tag #44

Closed mjcrouch closed 4 years ago

mjcrouch commented 4 years ago

Hi,

I've recently started using markdown for some docs (with mkdocs), and noticed an issue when svg_object is used as the output format for plantuml

As shown, when opened in firefox, all content in the generated page is truncated below the SVG.

image

I believe the issue is that the code shown above results in the following HTML:

<object alt="uml diagram" class="uml" data="data:image/svg+xml..(lots of data)..." title="" />

Note that the tag is self-closing. Looking at the HTML spec section 3.2.2.1:

In HTML, the use of this syntax is restricted to void elements and foreign elements. If it is used for other elements, it is treated as a start tag. In XHTML, it is possible for any element to use this syntax. But note that it is only conforming for elements with content models that permit them to be empty.

So - the tag should be rendered as <object alt="..."...></object> rather than as a self-closing tag.

Firefox seems to be interpreting this strictly resulting in a truncated page (though, sometimes I have seen it not truncate as well!). If I modify the generated HTML to use a closing tag then the page displays fine.

obviously svg_inline could generally be used instead, but thought this was worth mentioning

Thanks

mikitex70 commented 4 years ago

Hi @mjcrouch, thanks for reporting this issue. I've just release a fix in the new version 3.3.0.