Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [pull #623] Don't escape plus signs in URLs (#621)
- [pull #626] Fix XSS when encoding incomplete tags (#625)
- [pull #628] Fix TypeError in MiddleWordEm extra when options was None (#627)
- [pull #630] Fix nbsp breaking tables (#629)


## python-markdown2 2.5.3
Expand Down
2 changes: 1 addition & 1 deletion lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3576,7 +3576,7 @@ def run(self, text):
return table_re.sub(self.sub, text)

def sub(self, match: re.Match) -> str:
trim_space_re = '^[ \t\n]+|[ \t\n]+$'
trim_space_re = r'^\s+|\s+$'
trim_bar_re = r'^\||\|$'
split_bar_re = r'^\||(?<![\`\\])\|'
escape_bar_re = r'\\\|'
Expand Down
14 changes: 14 additions & 0 deletions test/tm-cases/tables_nbsp_issue629.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>Foo</td>
<td>123</td>
</tr>
</tbody>
</table>
1 change: 1 addition & 0 deletions test/tm-cases/tables_nbsp_issue629.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{'extras': ['tables']}
3 changes: 3 additions & 0 deletions test/tm-cases/tables_nbsp_issue629.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
| A | B |
|-----|-----| 
| Foo | 123 |