Repository navigation
Conversation
|
Thanks @waylan. For comparison: #1719 is essentially the same fix (a helper that serializes |
f229286 to
3143b71
Compare
|
Both fixes are essentially the same and either would be fine. However, neither includes comprehensive tests which cover every possible scenario. That said, #1719 includes more comprehensive tests that this does. |
Boolean options (e.g. linenums) set via attr_list were passed to the escape helper as bool objects, raising TypeError when codehilite is not enabled. Serialize them the way the serializer does. Fixes Python-Markdown#1713. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
3143b71 to
7e72636
Compare
waylan
left a comment
There was a problem hiding this comment.
That's a good start. However, that only tests output_format=xhtml. We would need the same set of tests with output_format=html as well.
| ), | ||
| self.dedent( | ||
| ''' | ||
| <pre><code class="language-py" linenums="linenums" title="a & b" nowrap="false"># Some python code |
There was a problem hiding this comment.
Why is nowrap="false" being passed through here? That seems wrong to me. The test above (line 477) does not pass through the key with a false value, which is expected.
Description
Fixes #1713. When
fenced_codeandattr_listare enabled butcodehiliteis not, boolean options such aslinenums=truewere passed to_escape_attrib_htmlasboolobjects, raisingTypeError: cannot serialize True. Following the plan in the issue thread, values are now serialized as the serializer would:None->key;True-> barekeyfor HTML boolean attributes withhtmloutput, otherwisekey="key";False-> omitted.Test plan: added two tests in
tests/test_syntax/extensions/test_fenced_code.py(fail before, pass after); fullpython -m unittest discover testspasses; flake8 clean on changed files.AI Assistance Disclosure
No AI tools were used in preparing this PR.
AI tools were used and I have disclosed which ones, and have fully reviewed and verified their output.
AI tools were use to assist with the following:
Checklist