Skip to content

Let plugins add options to .mdformat.toml file #378

@csala

Description

@csala

Context

Currently, mdformat plugins are allowed to implement a add_cli_options function to add arguments to the mdformat ArgumentParser, but there is no way to allow those options to be added to the .mdformat.toml file without monkey patching the mdformat._conf module to add the new options to the DEFAULT_OPTS dictionary or _validate_keys and _validate_values functions.

Proposal

Add a way for plugins to declare acceptable options and values for the mdformat.toml file.

Along the way, maybe also slightly reformat how the options are declared, so that they are not hard-coded in two different places (_conf and _cli) independently. An option for this would be to have them declared only inside _conf, with a way for plugins to alter them, and then have both the _cli.ArgumentParser and the _conf validation functions read and use them.

Tasks and updates

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions