gomarkdown / markdown

markdown parser and HTML renderer for Go
Other
1.38k stars 172 forks source link

Add SVG elements #313

Closed kensanata closed 1 month ago

kensanata commented 1 month ago

SVG is now part of HTML 5. Add all the SVG elements from https://developer.mozilla.org/en-US/docs/Web/SVG/Element with the exception of "a", "script" and "style" elements.

kjk commented 1 month ago

Thanks!

kensanata commented 1 month ago

Argh! I just looked at it again and I think I misunderstood. In blockTags we only need the elements that can be used without special escaping, right? Perhaps this means that the only actual element that needs to be added is svg, not all of them.

kensanata commented 1 month ago

Then again, perhaps this means that we can fix #303 by simply adding the math element. I'll prepare another merge request that does that.

kjk commented 1 month ago

My bad, I didn't really look and I don't know those details off the top of my head.

Hence, I reverted the commit.

My suggestion: write a failing test case that shows that behavior you expect doesn't happen then make the change to fix it.

The only way to know for sure what difference the change will make.

kensanata commented 1 month ago

Yeah. Will do. For my needs it "worked" … but it also added a lot of unnecessary elements. I think the SVG section of the HTML 5 specification says that svg is always the top level element, just like math for MathML. But adding tests is always better.