Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow images without alt attribute #198

Closed
winniehell opened this issue Dec 28, 2014 · 3 comments
Closed

Allow images without alt attribute #198

winniehell opened this issue Dec 28, 2014 · 3 comments
Assignees
Labels

Comments

@winniehell
Copy link
Contributor

@winniehell winniehell commented Dec 28, 2014

Current behavior for images with missing alt attribute is:

$ kramdown -ihtml -okramdown <<<'<img src=""/>'
/var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/kramdown.rb:289:in `convert_img': undefined method `gsub' for nil:NilClass (NoMethodError)
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/kramdown.rb:32:in `convert'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/kramdown.rb:59:in `block in inner'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/kramdown.rb:52:in `each'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/kramdown.rb:52:in `each_with_index'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/kramdown.rb:52:in `inner'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/kramdown.rb:361:in `convert_root'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/kramdown.rb:32:in `convert'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/converter/base.rb:104:in `convert'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/lib/kramdown/document.rb:120:in `method_missing'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/bin/kramdown:61:in `block in '
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/bin/kramdown:61:in `each'
    from /var/lib/gems/1.9.1/gems/kramdown-1.5.0/bin/kramdown:61:in `'
    from /usr/local/bin/kramdown:23:in `load'
    from /usr/local/bin/kramdown:23:in `'

whereas

$ kramdown -ihtml -okramdown <<<'<img src="" alt=""/>'
![]()

works perfectly fine.

Please consider treating missing alt attributes as empty.

@gettalong gettalong self-assigned this Dec 28, 2014
@gettalong
Copy link
Owner

@gettalong gettalong commented Dec 28, 2014

Thanks for the bug report, this should certainly be done.

@gettalong
Copy link
Owner

@gettalong gettalong commented Feb 4, 2015

Fixed this.

@gettalong gettalong closed this Feb 4, 2015
@gettalong gettalong added the bug label Feb 4, 2015
@winniehell
Copy link
Contributor Author

@winniehell winniehell commented Feb 4, 2015

Thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants