Repository navigation
Conversation
…is off Boolean options such as `linenums` set in an `attr_list` raised `TypeError` when `codehilite` was not enabled. Attributes are passed on to the output unchanged and serialized the way the serializer does: `None` as a bare key, `True` as a bare key for HTML boolean attributes in `html` output and `key="key"` otherwise, and `False` as nothing. Fixes Python-Markdown#1713. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: jeej1k <351634202+jeej1k@users.noreply.github.com>
Member
13 of 15 tasks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: jeej1k <351634202+jeej1k@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #1713. Replaces #1716, which took the wrong approach (it dropped the attributes). Note that #1718 proposes the same fix.
As @waylan explained in #1713, without
codehilitethe attributes may be meant for a JS highlighting library and must not be removed.fenced_codebypasses the serializer, so it now reproduces the serializer's handling (#1674) for the values it keeps as Python booleans:None=>keyTrue=>keyif the output format ishtmlandkeyis inBOOLEAN_ATTRIBUTES['html'], otherwisekey="key"False=> nothing is outputkey="escaped value"as beforeTests cover
None/True/False,htmlandxhtmloutput, and with and withoutcodehilite(and with and without Pygments). The full test suite passes locally.I read "
value == False=> (an empty string)" as the attribute being omitted, not rendered askey="". Please tell me if you meant the latter.jeej3000 and jeej1k are both my accounts; jeej1k is credited as co-author as a backup in case one account is lost.
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
🤖 Generated with Claude Code