Skip to content

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

Merged
chrisjsewell merged 5 commits into
executablebooks:masterfrom
Quinnod345:fix/preserve-falsey-cli-parsers
Nov 9, 2026
Merged

chrisjsewell merged 5 commits into
executablebooks:masterfrom
Quinnod345:fix/preserve-falsey-cli-parsers

Conversation

@Quinnod345

Copy link
Copy Markdown
Contributor

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.

Quinnod345 and others added 5 commits November 5, 2026 20:31
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.
The three wrappers around a shared helper become one test parametrized over
stdin, file and interactive. It also pins `sys.platform` as `test_tables` does,
since the interactive heading now names the platform's EOF keys and the
expected Ctrl-D text failed on Windows.
@chrisjsewell
chrisjsewell merged commit ebec021 into executablebooks:master Nov 9, 2026
15 checks passed
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.

2 participants