Closed jspaezp closed 1 month ago
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
Thanks for the issue!
I'm inclined to reject this to reduce configuration parsing complexity and to not set a bad precedent for what will be merged in the future.
pyproject.toml is a Python specific file so I really like that Python specific tools (pytest, black, tox, mypy etc.) support it. Mdformat is a programming language agnostic tool, however, so I don't think it should support a Python specific file.
Thanks for replying!
I think we can leave this open and see if it gets some traction. I can definitely understand not wanting to add more stuff due to the "maintainance tax" down the road and I understand the rationale behind it.
Implementation right now seems easy so if you need a PR just mention me and I could give it a go. Best!
Definitely in favor of adding support for .pyproject.toml
, but @hukkin has a point in this comment about mdformat
not being strictly focused on Python projects.
What about adding a --config-file
option instead? Then mdformat
is not really adhering to any standard in particular other than the toml
format, and users are still able to add their settings in the pyproject.toml
if it exists, but also in any other configuration file that is parseable as toml
(like setup.cfg
or any other .ini
file).
I created this plugin which covers the request of this issue.
I'm rejecting this, please see https://github.com/executablebooks/mdformat/issues/356#issuecomment-1246596603
csala's plugin exists for those who need this feature https://pypi.org/project/mdformat_pyproject/
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 fileProposal
I think an approach would be ...
modify this function: https://github.com/executablebooks/mdformat/blob/2b3145d43909b15cbf84bb2c16705d24cecf177a/src/mdformat/_conf.py#L26-L44
so that:
.mdformat.toml
if it is not found, look for
pyproject.toml
tool.mdformat
section.mdformat.toml
LMK what you think, I could make it a PR later in the week
Tasks and updates