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

Parser crashes if empty tag is found in table cell when html_to_native option is enabled #514

Closed
mojavelinux opened this Issue May 18, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@mojavelinux
Contributor

mojavelinux commented May 18, 2018

If the html_to_native option is enabled, and an empty tag is found in a table cell, the parser crashes because the value of the node is nil.

Here's a test case:

| abc    | def |
| ------ | --- |
| a<br>b | c   |

The error occurs in Table#parse_table

while (c = root.children.shift)
  lines = c.value.split(/\n/)
  ...
end

A simple nil check will fix the problem. I also recommend using a string instead of a regexp to split.

I'd be happy to submit a PR to correct this problem.

mojavelinux added a commit to mojavelinux/kramdown that referenced this issue May 18, 2018

@mojavelinux

This comment has been minimized.

Contributor

mojavelinux commented May 20, 2018

PR available. See #515.

@gettalong gettalong self-assigned this May 23, 2018

@gettalong gettalong added the bug label May 23, 2018

@gettalong

This comment has been minimized.

Owner

gettalong commented May 23, 2018

Thank you for the bug report and fix!

@gettalong gettalong closed this May 23, 2018

@gettalong gettalong closed this in a33704d May 23, 2018

@mojavelinux

This comment has been minimized.

Contributor

mojavelinux commented May 24, 2018

I'm glad to help! Thanks for reviewing and merging, @gettalong!

@mojavelinux

This comment has been minimized.

Contributor

mojavelinux commented May 30, 2018

@gettalong would you be willing to do a patch release that includes this fix? I'm processing a large number of Markdown documents and this bug is being triggered, which is preventing the conversion from running to completion. Thanks!

@gettalong

This comment has been minimized.

Owner

gettalong commented May 31, 2018

I'm in the process of going through all commits and issues/pull request since the last release - release will be today or in the next few days.

@mojavelinux

This comment has been minimized.

Contributor

mojavelinux commented May 31, 2018

Thanks @gettalong! I really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment