Skip to content

docs: clarify the Python and CLI options for file variables - #736

Merged
nicholasserra merged 2 commits into
trentm:masterfrom
Ychris12138:docs/file-vars-python-option
Oct 13, 2026
Merged

nicholasserra merged 2 commits into
trentm:masterfrom
Ychris12138:docs/file-vars-python-option

Conversation

@Ychris12138

@Ychris12138 Ychris12138 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

The CLI help lists use-file-vars as an extra, but passing extras=["use-file-vars"] does not enable file variables, as reported in #269 and #365.

Remove the incorrect extras entry, and combine the CLI flag and Python API option in the existing README explanation. Keep the Emacs-style comment syntax and CLI example, and use the standard [pull #736] changelog format. The CLI flag remains documented by argparse; parser behavior is unchanged.

Validation: 288 tests passed with make testone, all 7 ReDoS checks passed, and all 6 Python examples extracted from the README passed doctest. Also verified the three documented Python API forms, the CLI example, argparse help, and git diff --check.

AI-assisted contribution using OpenAI Codex.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 03:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread README.md Outdated
$ markdown2 --use-file-vars foo.md > foo.html
```

In the Python API, pass `use_file_vars=True` to `markdown()`, `markdown_path()`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is a bit verbose, especially compared to the style of the other examples in the readme.

There is also an example for the CLI flag just above it. Maybe could be combined and shortened alot?

Comment thread CHANGES.md Outdated

## python-markdown2 2.5.6 (not yet released)

- Clarify how to enable file variables in the Python API and command-line help (#269, #365).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog in wrong format

Comment thread lib/markdown2.py Outdated
* wavedrom: Support for generating Wavedrom digital timing diagrams
* xml: Passes one-liner processing instructions and namespaced XML tags.

Use --use-file-vars to enable extras declared in Emacs-style file variables

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag is documented with argparse, the user can see that when running python markdown2.py --help.

Doesn't need to be documented here, and also we don't document any of the other CLI flags or params passed to markdown here

@nicholasserra

Copy link
Copy Markdown
Collaborator

Thank you!

@nicholasserra
nicholasserra merged commit 4ebed1d into trentm:master Oct 13, 2026
18 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.

4 participants