bhollis / maruku

A pure-Ruby Markdown-superset interpreter (Official Repo).
MIT License
500 stars 80 forks source link

Optional Title Ignored in Image Tag #37

Closed sxross closed 12 years ago

sxross commented 13 years ago

Version: 0.6.0, Ruby 1.8.7 p302

The following works as expected:

echo '![alt text](/path/to/image)'|maruku
<p><img src='/path/to/image' alt='alt text' /></p>

The following fails because it ignores the optional title string inside the parentheses:

echo '![alt text](/path/to/image "with title")'|maruku
<p><img src='/path/to/image' alt='alt text' /></p>

BTW: The workaround is burdensome to users who must put the title in an attribute list:

[alt text](/path/to/image){: title="with title"}

As this syntax is documented in the Maruku dox and the Daring Fireball ones, it would be good if it worked :)

distler commented 13 years ago

Indeed.

Fixed on my Nokogiri branch.

bhollis commented 12 years ago

I've pulled @distler's fix.

simonrepp commented 11 years ago

I just experienced exactly this same problem, running ruby 2.0.0p247 and maruku 0.6.1:

::Maruku.new('![the alt](/path/to/some/image.jpg "the title")').to_html

resulting in

<p><img src="/path/to/some/image.jpg" alt="the alt" /></p>

The workaround as it is described in the original issue above is working for me. If anyone else can reproduce this I guess it might be worth taking a look at? I'm sorta baffled and unsure how to look further into this, especially seeing that exactly this seems to have been adressed previously :)