You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
attr_list ext strips curly braces from table cells #898
If I had to guess, it would probably be due to the inclusion of the attr_list extension in extra. As there is now additional syntax to be aware of, escaping the leading { may be the way to go.
Now, should attr_list even handle empty {}? That is a good question that should probably get discussed.
Yes, this is specific to the attr_list extension, which extra includes. What is not clear to me is why this is happening in table cells as it doesn't happen outside of table cells.
That said, things like a{} look like code to me and, if it is code, should be enclosed in code spans, which should eliminate the issue.
A | B
----- | -----
`a{}` | `b{}`
Alternatively, as the attr_list extension adds the curly brackets as syntax, it also adds support for those characters to be escaped; like this: a\{}.
Regardless, the behavior within a table cell should match the behavior outside of one, which it doesn't. So from that perspective we have a bug of sorts.
Regardless, the behavior within a table cell should match the behavior outside of one, which it doesn't. So from that perspective we have a bug of sorts.
That depends... this is happening because <td> is considered to be a "block level" element:
Block level elements are allowed (required?) to have their attr lists put on the same line, so that's why this is happening here. Maybe <td> shouldn't be a block level element though...
Block level elements are allowed (required?) to have their attr lists put on the same line
Not true. Of all supported block-level elements, only header (h1-6) and dt elements can have an attr list on the same line. All other block level elements require the attr list to be on a separate line by itself (specifically the last line).
That said, I see we are special casing td elements specifically.
In fact, lines 123 and 124 were added in #267 specifically to ensure td elements get treated as inline elements by the attr list extension. Presumably that fix was incomplete as it is matching an empty list. It appears that that is the only place BASE_RE is used by itself. Everywhere else, BASE_RE is combined with a wrapper that in less likely to result in false matches. We probably need to modify the td case to not match an empty list.
Activity
facelessuser commentedon Jan 28, 2020
If I had to guess, it would probably be due to the inclusion of the attr_list extension in
extra. As there is now additional syntax to be aware of, escaping the leading{may be the way to go.Now, should
attr_listeven handle empty{}? That is a good question that should probably get discussed.waylan commentedon Jan 28, 2020
Yes, this is specific to the
attr_listextension, whichextraincludes. What is not clear to me is why this is happening in table cells as it doesn't happen outside of table cells.That said, things like
a{}look like code to me and, if it is code, should be enclosed in code spans, which should eliminate the issue.Alternatively, as the
attr_listextension adds the curly brackets as syntax, it also adds support for those characters to be escaped; like this:a\{}.Regardless, the behavior within a table cell should match the behavior outside of one, which it doesn't. So from that perspective we have a bug of sorts.
[-]extension 'extra' strips curly braces in tables[/-][+]attr_list ext strips curly braces from table cells[/+]jimporter commentedon Jan 31, 2020
That depends... this is happening because
<td>is considered to be a "block level" element:markdown/markdown/core.py
Line 85 in 6651746
Block level elements are allowed (required?) to have their attr lists put on the same line, so that's why this is happening here. Maybe
<td>shouldn't be a block level element though...waylan commentedon Jan 31, 2020
Not true. Of all supported block-level elements, only header (
h1-6) anddtelements can have an attr list on the same line. All other block level elements require the attr list to be on a separate line by itself (specifically the last line).That said, I see we are special casing
tdelements specifically.markdown/markdown/extensions/attr_list.py
Lines 120 to 130 in 6651746
In fact, lines 123 and 124 were added in #267 specifically to ensure
tdelements get treated as inline elements by the attr list extension. Presumably that fix was incomplete as it is matching an empty list. It appears that that is the only placeBASE_REis used by itself. Everywhere else,BASE_REis combined with a wrapper that in less likely to result in false matches. We probably need to modify thetdcase to not match an empty list.jimporter commentedon Jan 31, 2020
Oh, hm. I guess I didn't look closely enough at that code. Oh well. vOv
Tune attr list regex
Tune attr list regex
Tune attr list regex