Python-Markdown / markdown

A Python implementation of John Gruber’s Markdown with Extension support.
https://python-markdown.github.io/
BSD 3-Clause "New" or "Revised" License
3.74k stars 858 forks source link

Allow attr_list quoted values to contain curly braces #1414

Closed oprypin closed 6 months ago

oprypin commented 10 months ago

How it worked before:

How it works now:

oprypin commented 10 months ago

I'm quite happy and confident with this change, and actually it preserves prior behavior very well in cases that were already recognized as an attr_list. (As evidenced by not needing to change anything in existing test cases). But maybe we should give it time in case someone finds more edge cases.

oprypin commented 10 months ago

I think the "legacy" approach is way more developer-friendly. I don't want to develop a new test file. If that's a blocker, I hope someone can help out with a commit based on this one.

waylan commented 10 months ago

The test file already exists. I even pointed to it, but here it is again test_syntax/extensions/test_attr_list.py. You just need to add a test case. And yes, this would be a blocker.

waylan commented 6 months ago

In this comment I stated:

if someone were to submit a PR which consistently altered the attr_list behavior across all elements to allow curly braces, I would be wiling to give it consideration.

"All elements" includes fenced code blocks (which is clear if you read the proceeding paragraph). However, fenced code blocks have not been addressed here at all. Note that I have added a relevant test, which is currently failing. That test, and potentially some other similar (yet to be created) tests need to be passing before the stated requirements are met.

oprypin commented 6 months ago

Thanks for the test. OK let me quickly check that out.

oprypin commented 6 months ago

Alright, done!

Note: Out of all the newly added tests, only these 3 tests don't pass with preexisting code: testFencedCodeCurlyInAttrs test_curly_in_double_quote test_curly_in_single_quote

For all others, preexisting behavior is preserved.