diff --git a/CHANGES.md b/CHANGES.md index b0c5e7bd..fa0cf274 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## python-markdown2 2.5.6 (not yet released) +- [pull #729] Fix `tables` extra merging cells when a pipe directly follows a code span, as in compact rows like `|`-v`|verbose|`. - [pull #725] Fix `tables` extra dropping escaped pipes at the end of header and body rows. - [pull #687] Fix AssertionError hashing HTML blocks spread over multiple lines (#686) - [pull #692] Fix XSS from code spans in link titles (#691) diff --git a/lib/markdown2.py b/lib/markdown2.py index 5fa8cf58..9243bee8 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -4260,10 +4260,16 @@ def _split_row(row: str) -> list[str]: # An escaped final pipe belongs to the last cell, not the table border. if not row.endswith(r'\|'): row = row.removesuffix('|') - return [ - re.sub(r'\\\|', '|', cell.strip()) - for cell in re.split(r'(? str: head, underline, body = match.groups() diff --git a/test/tm-cases/tables_code_span_adjacent_pipe.html b/test/tm-cases/tables_code_span_adjacent_pipe.html new file mode 100644 index 00000000..2fba4711 --- /dev/null +++ b/test/tm-cases/tables_code_span_adjacent_pipe.html @@ -0,0 +1,18 @@ +
| Flag | +Meaning | +
|---|---|
-v |
+ verbose | +
-q |
+ quiet |
+