-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Slow parsing of HTML tables with loaded cells #3991
Comments
Originally found while attempting to parse HTML documents (using pandoc as a library), so apparently it's a parsing issue -- not that of conversion or printing. |
Interestingly, if you run tidy on this HTML, pandoc parses
it almost instantly. So looking at the tidy warnings might
give some useful insight into what is causing the problem.
It isn't tables per se -- it's probably caused by unclosed
tags within table cells, or something like that.
Note: I get lots of errors/warnings both with tidy and
with the HTML5 validator at https://html5.validator.nu.
For example, at line 20, column 670, there's a `<p>` tag
inside a `<span>` element -- that's not allowed. No wonder
pandoc gets confused.
It would still be good if pandoc could handle this kind of
broken HTML, though.
|
If you use `-f html-native_spans`, then it works fine.
So that shows that it's getting confused by the unmatched
div tags in this document.
|
Look at line 421:
<div class="comment">
<span class="c00">Pandoc just make me happy. Thanks John & contributors for your work!<span>
</span><div class='reply'> <p><font size="1">
</font>
</div></td></tr>
Here we have two open div tags, then a close div tag and a
close td. Pandoc should know to close the open div tag
when it hits the close td.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Attempting to parse HTML tables akin to those of HN comments takes the time that seems to grow exponentially as the amount of
tr
elements grows: here it takes about 4 seconds with 9 comments, 8 with 10, 16-18 with 11, etc. Empty tables don't have the same effect, apparently the inner elements contribute to that somehow.Reproduction:
Versions:
The text was updated successfully, but these errors were encountered: