dprint-plugin-markdown icon indicating copy to clipboard operation
dprint-plugin-markdown copied to clipboard

feat: add HeadingKind (setext or ATX) formatting options.

Open bjones1 opened this issue 1 month ago • 0 comments

I'd like to add an option on how Markdown headings are formatted: either as ATX (the usual):

# Level 1 heading
## Level 2 heading

or setext (the addition):

Level 1 heading
===============

Level 2 heading
---------------

This PR also plugs a small test hole (wrapping wasn't enabled for Headers_All.txt.

A question: for setext headers, this code must create an underline. To produce a visually appealing underline, it should split the heading text (which may contain more than one line) into lines, then determine the length of the longest line. Note that this length should be determined after formatting, since lines may be wrapped during the formatting process.

Is there any way to add a post-processing step which would allow my code to examine the formatted output of a heading, then produce the appropriate-length underline?

Thanks for the great tool!

bjones1 avatar Nov 03 '25 19:11 bjones1