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

images with no alt text #114

Closed Zune01 closed 9 years ago

Zune01 commented 11 years ago

Now, I haven't been able to find anything conclusive, but how do you add an image link in pegdown without an alt text?

![](image.png) 

does not create an image in 1.4, or is it that I have to enable an extension? According to the markdown web dingus this should render as

<p><img src="image.png" alt="" title="" /></p>

but I get the input as output.

gitblit commented 10 years ago

After looking at the code, injecting a space in the alt text satisfies the parser's expectation of at least 1 character and allows generation of an image tag with a blank alt text.

![ ](image.png)
wienczny commented 10 years ago

Could this be fixed by changing line 979 of file from

OneOrMore(TestNot(']'), NonAutoLinkInline(), addAsChild()),

to

ZeroOrMore(TestNot(']'), NonAutoLinkInline(), addAsChild()),

?

rschrader commented 10 years ago

Awesome work ;)

elennaro commented 10 years ago

Agree with @wienczny. Good suggestion! Do need this very much!