Repository navigation
🐛 FIX: Honor empty rule lists in custom presets - #467
Open
anticipate218 wants to merge 1 commit into
Open
anticipate218 wants to merge 1 commit into
anticipate218 wants to merge 1 commit into
Conversation
Forward explicitly empty rules and rules2 lists to enableOnly so custom presets can disable an entire parser chain. Keep missing and None values unchanged; cover all four chains and literal inline rendering. Assisted-by: OpenAI Codex
This branch has not been deployed
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.
An explicit empty
ruleslist in a custom preset currently leaves every rule enabled. For example, copying the commonmark preset and settingcomponents['inline']['rules'] = []still renders emphasis and links. Python treats the empty list as false, whereas the upstream JavaScript check treats an empty array as present.Check for
Nonebefore applyingrulesorrules2, so an empty list reachesenableOnlyand clears that chain. Omitted andNonevalues keep the current behavior. Tests cover all four chains and literal inline rendering; documentation and the changelog describe the distinction.Validation on Windows:
tox -e py313withPYTHONUTF8=1: 1,192 passed on Python 3.13.9. Without UTF-8 mode, two pre-existing file-regression output fixtures raise encoding errors on this cp936 system; the same two failures reproduce on the original source.--ignore-missing-imports; applicable JSON/YAML/EOF/whitespace checks pass. Full pre-commit initialization failed while fetching the mypy mirror from GitHub.echoomitted because it is unavailable as an executable on Windows. No repository configuration was changed for these command overrides.Other Python versions/platforms, benchmarks, link checking and the separate plugin-repository test suite were not run.
AI assistance: Codex investigated and prepared the patch/tests; another agent independently reviewed the behavior and ran the configuration matrix.