You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--use-file-vars now works as a flag. Previously argparse expected a value, so placing it before an input filename consumed the filename; using it with stdin or after a filename failed with a missing-argument error.
This also fixes a crash when an Emacs-style file variable enables header-ids. Those options are loaded after construction, so they need the same normalization as constructor extras before heading rendering. The shared helper preserves initialization behavior and existing reset-count settings.
Related to #365 and #269. This addresses the CLI flag and header-id file variables, rather than every file-variable extra. The README includes a working command and modeline example.
Compatibility: the flag no longer accepts a value. A token after --use-file-vars is an input path; --use-file-vars=VALUE is rejected.
Validation:
Regression tests failed on the base: five CLI failures and one API error, with the no-flag control passing.
Mac Python 3.13.13: make testone passed 275 tests; the seven existing ReDoS regressions passed.
Linux Python 3.13.15: the same 275 functional tests, seven existing ReDoS tests, internal doctests, and 12 installed-wheel API/CLI checks passed. All 887 source file hashes matched before and after validation.
New CLI tests pass pycodestyle. The two existing changed Python files retain the same 475 pre-existing pycodestyle diagnostics, with none added.
Wheel and source distributions build; Twine passes with the existing missing long_description_content_type warning.
So is this backwards compatible? Your comment about compatibility made me question whether the --use-file-vars flag took some kind of input, but it appears it doesn't?
Yes, apart from one odd form. --use-file-vars is a plain boolean flag now (action="store_true"). Before this change the argument had no action, so argparse required a value: markdown2 --use-file-vars foo.md swallowed the path as the flag's value and read stdin instead, and putting the flag after the path errored with "expected one argument". The only way it ever worked was to pass a throwaway value, e.g. --use-file-vars 1 foo.md, and that form now treats 1 as an input path. That is the compatibility note in the description. The library API (use_file_vars=True) is unchanged.
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
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.
--use-file-varsnow works as a flag. Previously argparse expected a value, so placing it before an input filename consumed the filename; using it with stdin or after a filename failed with a missing-argument error.This also fixes a crash when an Emacs-style file variable enables
header-ids. Those options are loaded after construction, so they need the same normalization as constructor extras before heading rendering. The shared helper preserves initialization behavior and existingreset-countsettings.Related to #365 and #269. This addresses the CLI flag and header-id file variables, rather than every file-variable extra. The README includes a working command and modeline example.
Compatibility: the flag no longer accepts a value. A token after
--use-file-varsis an input path;--use-file-vars=VALUEis rejected.Validation:
make testonepassed 275 tests; the seven existing ReDoS regressions passed.long_description_content_typewarning.