generated from executablebooks/mdformat-plugin
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Context
After #4 has been resolved, if mdformat-pyproject is installed, .mdformat.toml is fully ignored if it exists.
This can be confusing to some users who might find that the options that they set in .mdformat.toml are ignored if they are not aware of having mdformat-pyproject installed.
Proposal
The proposed behavior is to imitate the approach used by ruff, which is to support both pyproject.toml options and its own .ruff.toml configuration file, but giving precedence to its own .ruff.toml file if both exist.
In our case, this translates into:
- When looking for configuration, search for both
.mdformat.tomlfile andpyproject.tomlwithmdformatoptions, scaling up the directory tree. - If an
.mdformat.tomlis found in a directory, parse its options and stop the search, even if it defines none. - If a
pyproject.tomlis found and it contains anmdformatsection, parse its options and stop the search, even if it defines none. - If no
mdformat.tomlis found and nopyproject.tomlis found or if apyproject.tomlis found but does not have anmdformatsection, we move one level up the tree and continue searching.
As a consequence:
pyproject.tomlfiles that do not define anmdformatsection are ignored- If the first directory in which configuration is found contains both an
.mdformat.tomlfile and apyproject.tomlfile that also defines anmdformatsection, only the options from.mdformat.tomlare considered, andpyproject.tomlis ignored.
To prevent confusions, if a pyproject.toml with mdformat section is found but it is ignored because an .mdformat.toml file exists in the same directory, a warning should be given.
Metadata
Metadata
Assignees
Labels
No labels