Skip to content
Open
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
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ See the [Contributing Guide](contributing.md) for details.

### Fixed

* An empty attribute list written with a colon, such as `{: }`, is left as text
like `{ }`, instead of adding an attribute named `:` (#1734).
* Fix a doubled `mailto:` in automatic email links which write the scheme in
upper or mixed case, such as `<MAILTO:foo@example.com>` (#1733).
* Fix cubic processing time in the `legacy_attrs` extension for text with many
Expand Down
2 changes: 1 addition & 1 deletion markdown/extensions/attr_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def sanitize_name(name: str) -> str:

class AttrListTreeprocessor(Treeprocessor):

BASE_RE = r'\{\:?[ ]*([^\}\n ][^\n]*)\}'
BASE_RE = r'\{(?!\:[ ]*\})\:?[ ]*([^\}\n ][^\n]*)\}'
HEADER_RE = re.compile(r'[ ]+{}[ ]*$'.format(BASE_RE))
BLOCK_RE = re.compile(r'\n[ ]*{}[ ]*$'.format(BASE_RE))
INLINE_RE = re.compile(r'^{}'.format(BASE_RE))
Expand Down
6 changes: 6 additions & 0 deletions tests/test_syntax/extensions/test_attr_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,9 @@ def test_key_without_value(self):
'Key without *value*{ foo= }',
'<p>Key without <em foo>value</em></p>'
)

def test_empty_list_with_colon(self):
self.assertMarkdownRenders(
'# Heading {: }\n\n*text*{:}',
'<h1>Heading {: }</h1>\n<p><em>text</em>{:}</p>'
)
Loading