Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pass
recursive=Falsetofind_all()inMarkdownConverter.convert_tr()so nested tables inside cells do not distort the outer table's header detection or column count.Root cause
convert_tr()calledel.find_all(['td', 'th']),el.parent.find_all('tr'), andel.parent.parent.find_all(['thead'])withoutrecursive=False. When a cell in the first row contained a nested<table>, the descendant<td>/<th>/<tr>/<thead>tags were counted toward the outer row:all(cell.name == 'th' for cell in cells)evaluated toFalsewhen a<th>contained nested<td>cells, turning a real header row into a synthetic empty header.full_colspansummed the nested cells alongside the outer cells, producing a separator row with too many columns (for example 4 columns for a 2-column table).Solution
markdownify/__init__.py: passrecursive=Falseto the threefind_all()calls inconvert_tr().tests/test_tables.py: addtest_table_nested_in_first_rowandtest_table_nested_in_thead_and_tbody.Verification
pytest -q: 97 passed.flake8/mypy: checked with no errors.