attr_list ext strips curly braces from table cells · Issue #898 · Python-Markdown/markdown (original) (raw)

@mfrigerio17

Curly braces in the elements of a table get stripped away when the 'extra' extension is loaded

#! /usr/bin/env python3 import markdown from markdown.extensions.extra import ExtraExtension from markdown.extensions.tables import TableExtension

text = ''' Try {}

A B
a{} b{}

'''

extra = ExtraExtension() tables= TableExtension()

md = markdown.Markdown(extensions=[tables]) print( md.convert(text) ) # this is fine

print("\n\n")

md = markdown.Markdown(extensions=[tables, extra]) print( md.convert(text) ) # curly braces in the table are stripped

The output (comments added manually):

<p>Try {}</p>
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>a{}</td>  -- braces are there
<td>b{}</td>
</tr>
</tbody>
</table>


<p>Try {}</p>  -- these braces are preserved
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>a</td>  -- braces gone
<td>b</td>
</tr>
</tbody>
</table>

Is it an intended behaviour?