-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Context
It has become increasingly adopted the option to store the configuration of many tools inside the pyproject.toml file.
example for black:
https://ichard26-testblackdocs.readthedocs.io/en/refactor_docs/pyproject_toml.html
It would be amazing if mdformat could read it as well. And since mdformat already supports toml format configurations, it would be trivial to implement looking for the configuration in the tool.mdformat section of one's pyproject.toml file
# .mdformat.toml
#
# This file shows the default values and is equivalent to having
# no configuration file at all. Change the values for non-default
# behavior.
#
wrap = "keep" # possible values: {"keep", "no", INTEGER}
number = false # possible values: {false, true}
end_of_line = "lf" # possible values: {"lf", "crlf", "keep"}
# pyproject.toml
#.......
[tool.mdformat]
wrap = "keep" # possible values: {"keep", "no", INTEGER}
number = false # possible values: {false, true}
end_of_line = "lf" # possible values: {"lf", "crlf", "keep"}
Proposal
I think an approach would be ...
modify this function:
https://github.com/executablebooks/mdformat/blob/2b3145d43909b15cbf84bb2c16705d24cecf177a/src/mdformat/_conf.py#L26-L44
so that:
- it first looks for the
.mdformat.toml- if found use it
- if it is not found, look for
pyproject.toml- if found, look for a
tool.mdformatsection- if found use that as if it was the contents of
.mdformat.toml
- if found use that as if it was the contents of
- if found, look for a
LMK what you think, I could make it a PR later in the week
Tasks and updates
- implement changes
- add unit testing
- add documentation
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request