-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make heading style formatting configurable #283
Comments
Hey, thanks for the issue! Firstly, a few things that I'll likely be repeating in every issue that asks for configuration 😄 : As a user and especially as a maintainer, I prefer an opinionated formatter with good defaults over a configurable formatter. The benefits are:
And yeah, there are a few config knobs already but I don't want any more unless for a very good reason. I'll consider but please don't get your hopes up. It should be fairly trivial to come up with something like a |
@arwedus my context is similar to yours and the inability to configure mdformat blocks its use and has created additional work. @hukkin I have some incomplete local hacks to configure mdformat to conform to my context and some development help to complete this would be appreciated. I'd be happy to contribute a plugin which provides a general configuration feature if it's technically possible. |
This Issue motivated me to complete my hacking, which I've pushed to a branch on my fork: add-defaults-to-configuration. |
@hukkin: I'm fine with a heading-formatter plug-in, but will most likely not have time to work on that this year. I have some doubts about your argument that the number of tests required for n configuration options scales with n^2, though: One could use the classification tree method after partitioning the configuration space in equivalence classes. I.e., in a test case that handles lists, or paragraphs, I do not have to test different configuration options for the heading as headings cannot appear in those blocks. One only needs to extend all tests that handle headings by an additional test for the output formatting. Not even the part that detects headings in the input needs to be covered by more tests than before. |
I think this should be implemented in a plugin. |
Description / Summary
In our (big) project, we have the convention to format at least level 1 headings always with Setext (underline) - there is also always just one level 1 heading per document allowed. We leave it up to individual subprojects whether they want to consistently apply setext style headings for level 2 as well or whether they want to start using ATX headings there.
I kindly request a configuration option "first_atx_heading_level". Allowed values: (1, 2, 3). Default value: 1
Effect: All headings of level below and including "first_atx_heading_level" are formatted with ATX style. All levels above are consistently formatted with setext (underline).
Value / benefit
This would actually enable us to use your great program!
We have made the choice for Setext because a single
#
character is visually very unimpressive. Setext does an inversion: The lower the heading is, the more it stands out in the code. A single#
can also be confused with the start of a line comment in many scripting languages. Last but not least, we use MyST-parser and sphinx, mostly, and we want to keep a little visual consistency with the restructuredtext domain.Implementation details
No response
Tasks to complete
The text was updated successfully, but these errors were encountered: