Skip to content

🐛 FIX: Preserve falsey parsers in CLI helpers - #455

Open
Quinnod345 wants to merge 1 commit into
executablebooks:masterfrom
Quinnod345:fix/preserve-falsey-cli-parsers
Open

Quinnod345 wants to merge 1 commit into
executablebooks:masterfrom
Quinnod345:fix/preserve-falsey-cli-parsers

Conversation

@Quinnod345

Copy link
Copy Markdown

Passing a valid MarkdownIt subclass with a false truth value to the direct CLI helpers discards its configuration. A parser with table rules enabled renders a table directly, but convert_stdin, convert_file and interactive replace it and render a paragraph.

Create the default parser only when md is None. Add exact-output regressions for all three helpers and document the selection rule in their docstrings and the changelog. main() already creates an ordinary truthy parser; the reproduced case concerns callers supplying a parser directly.

Validation on CPython 3.13.11/macOS:

  • All three final regressions fail against upstream 6f58654 in an isolated source copy before the repair.
  • All 20 CLI tests and the complete 1,035-test suite pass afterward.
  • pre-commit run --all-files passes every applicable hook, including Mypy.

I maintain Ponder. Its review surfaced the parser replacement; the three added regressions reproduce it.

Only create the default parser when the optional argument is None.
Retain supplied instances and their configured rules for stdin, files
and interactive input. Ordinary main() behavior is unchanged.

Add three exact-output regressions, helper docstrings and a changelog
entry. All three regressions fail on the pinned upstream driver.

CPython 3.13.11/macOS: 20 CLI tests and 1,035 full-suite tests pass;
pre-commit --all-files, including Mypy, passes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant