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

<a> with <img> inside returns an empty string #8

Open
szimek opened this issue Jan 11, 2018 · 3 comments
Open

<a> with <img> inside returns an empty string #8

szimek opened this issue Jan 11, 2018 · 3 comments
Labels

Comments

@szimek
Copy link

szimek commented Jan 11, 2018

The following HTML code:

<a href="/"><img src="/image.jpg alt="Alt text" /></a>

gets converted to an empty string.

I wrote a simple failing test:

it('should convert an anchor with img tag inside to markdown', function () {
  isEqual.inline('<a href="/"><img src="/image.jpg" alt="Alt text" /></a>', '[![Alt text](/image.jpg)](/)');
});
@jonschlinkert
Copy link
Member

yeah, that's a bug. thanks for reporting it

@ScootRay
Copy link

I'm experiencing this issue as well, particularly with any images that are wrapped as a link as in the example above. How can i fix this?

Thanks!
Ray

@dmitryrck
Copy link

I have the same issue, but I found out in my case it was a <img> inside a <figure> inside a <div>, something like:

<div class="img" id="img6">
  <figure>
    <img alt="" src="/some/file.png">
  </figure>
</div>

I tested and removing only the <div> fixes it.

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

No branches or pull requests

4 participants