sirthias / pegdown

A pure-Java Markdown processor based on a parboiled PEG parser supporting a number of extensions
http://pegdown.org
Apache License 2.0
1.29k stars 217 forks source link

Img tags rendered incorrectly #121

Open dylemma opened 10 years ago

dylemma commented 10 years ago

https://github.com/sirthias/pegdown/blob/master/src/main/java/org/pegdown/ToHtmlSerializer.java#L399

This adds an extra " at the end of the generated html, creating invalid xml. For example:

![potato](http://i.imgur.com/dRnvRZZ.jpg)

becomes

<img src="http://i.imgur.com/dRnvRZZ.jpg" alt="potato""/>

(note the extra quote on "potato") which causes xml parsers (I'm using scala.xml.XML) to throw an exception.

trepidacious commented 10 years ago

I'm also seeing this, if you have an optional title the extra quote ends up after it:

![Alt text](screenshot.png "Optional title")

becomes:

<img src="screenshot.png" alt="Alt text" title="Optional title""/>