Skip to content

Commit adf4e81

Browse files
Merge pull request #630 from Crozzers/fix-629
Fix nbsp breaking tables (#629)
2 parents 03d2391 + a52b0c4 commit adf4e81

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [pull #623] Don't escape plus signs in URLs (#621)
88
- [pull #626] Fix XSS when encoding incomplete tags (#625)
99
- [pull #628] Fix TypeError in MiddleWordEm extra when options was None (#627)
10+
- [pull #630] Fix nbsp breaking tables (#629)
1011

1112

1213
## python-markdown2 2.5.3

lib/markdown2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,7 @@ def run(self, text):
35763576
return table_re.sub(self.sub, text)
35773577

35783578
def sub(self, match: re.Match) -> str:
3579-
trim_space_re = '^[ \t\n]+|[ \t\n]+$'
3579+
trim_space_re = r'^\s+|\s+$'
35803580
trim_bar_re = r'^\||\|$'
35813581
split_bar_re = r'^\||(?<![\`\\])\|'
35823582
escape_bar_re = r'\\\|'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<table>
2+
<thead>
3+
<tr>
4+
<th>A</th>
5+
<th>B</th>
6+
</tr>
7+
</thead>
8+
<tbody>
9+
<tr>
10+
<td>Foo</td>
11+
<td>123</td>
12+
</tr>
13+
</tbody>
14+
</table>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{'extras': ['tables']}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| A | B |
2+
|-----|-----| 
3+
| Foo | 123 |

0 commit comments

Comments
 (0)