executablebooks / mdformat

CommonMark compliant Markdown formatter
https://mdformat.rtfd.io
MIT License
437 stars 46 forks source link

Support plugin options in the configuration file #433

Closed pawamoy closed 6 months ago

pawamoy commented 6 months ago

Context

I've installed a bunch of plugins (mainly mdformat-mkdocs[recommended]) and see that some of them provide additional CLI flags. However these options do not seem to be recognized in the configuration file (unless I'm missing something):

% mdformat -h        
usage: mdformat [-h] [--check] [--version] [--number] [--wrap {keep,no,INTEGER}] [--end-of-line {lf,crlf,keep}] [--align-semantic-breaks-in-lists] [--ignore-missing-references] [paths ...]

CommonMark compliant Markdown formatter

positional arguments:
  paths                 files to format

options:
  -h, --help            show this help message and exit
  --check               do not apply changes to files
  --version             show program's version number and exit
  --number              apply consecutive numbering to ordered lists
  --wrap {keep,no,INTEGER}
                        paragraph word wrap mode (default: keep)
  --end-of-line {lf,crlf,keep}
                        output file line ending mode (default: lf)
  --align-semantic-breaks-in-lists
                        If specified, align semantic indents in numbered and bulleted lists to the text
  --ignore-missing-references
                        If set, do not escape link references when no definition is found. This is required when references are dynamic, such as with python mkdocstrings

Installed plugins: mdformat_tables: 0.4.1, mdformat_wikilink: 0.2.0, mdformat_admon: 2.0.2, mdformat_gfm: 0.3.6, mdformat_footnote: 0.1.1, mdformat_frontmatter: 2.0.8, mdformat_simple_breaks:
0.0.1, mdformat_mkdocs: 2.0.8, mdformat_config: 0.1.3, mdformat_ruff: 0.1.3, mdformat_web: 0.1.0, mdformat_beautysh: 0.1.1
wrap = "no"
number = true
end_of_line = "lf"
ignore_missing_references = true
% mdformat docs/posts
Error: Invalid key 'ignore_missing_references' in
/media/data/dev/website/.mdformat.toml. Keys must be one of {'number',
'end_of_line', 'wrap'}.

Proposal

Somehow support plugin options in the config file :blush:?

Tasks and updates

No response

pawamoy commented 6 months ago

Seems to be a duplicate of https://github.com/executablebooks/mdformat/issues/378.