diff options
| author | John MacFarlane <[email protected]> | 2023-10-19 11:06:40 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-10-19 11:07:22 -0700 |
| commit | 0fdac4984b61de9de07f730ea071ee2bb9f1076c (patch) | |
| tree | 7eada91460ff3f762955e1f35899cf1bfbf865f9 | |
| parent | 1529ff45e665e21623127561e7b8ce576b56de5c (diff) | |
HTML reader: allow th to close td and vice versa.
Closes #9090.
| -rw-r--r-- | src/Text/Pandoc/Readers/HTML/Parsing.hs | 2 | ||||
| -rw-r--r-- | test/command/9090.md | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/HTML/Parsing.hs b/src/Text/Pandoc/Readers/HTML/Parsing.hs index 33af013f4..ac24aa70b 100644 --- a/src/Text/Pandoc/Readers/HTML/Parsing.hs +++ b/src/Text/Pandoc/Readers/HTML/Parsing.hs @@ -104,6 +104,8 @@ pCloses tagtype = try $ do t <- lookAhead $ pSatisfy $ \tag -> isTagClose tag || isTagOpen tag case t of (TagClose t') | t' == tagtype -> void pAny + (TagClose "th") | tagtype == "td" -> void pAny -- see #9090 + (TagClose "td") | tagtype == "th" -> void pAny (TagOpen t' _) | t' `closes` tagtype -> return () (TagClose "ul") | tagtype == "li" -> return () (TagClose "ol") | tagtype == "li" -> return () diff --git a/test/command/9090.md b/test/command/9090.md new file mode 100644 index 000000000..a2c94b998 --- /dev/null +++ b/test/command/9090.md @@ -0,0 +1,15 @@ +``` +% pandoc -f html -t gfm +<table> + <tr> + <th>invalid head cell</td> + </tr> + <tr> + <td>body cell</td> + </tr> +</table> +^D +| invalid head cell | +|-------------------| +| body cell | +``` |
