Closed csala closed 1 year ago
Sometimes it would be desirable to run mdformat to obtain the formatted markdown string without modifying the original source file.
mdformat
For reference, other code formatting tools like black or isort offer this option in one way or another:
black
isort
stdin
stdout
-d/--debug
Add a way to format a file and dump the formatted contents to stdout without touching the file.
I see several ways of achieving this:
-
-o/--output <filename>
My preferred option here would be number 3, or a combination of 2 and 3, since this is the one that provides more flexibility.
Forget this. I did not realize that point 2. above is already supported
Context
Sometimes it would be desirable to run
mdformat
to obtain the formatted markdown string without modifying the original source file.For reference, other code formatting tools like
black
orisort
offer this option in one way or another:black
can be passed input viastdin
and then outputs tostdout
isort
has a-d/--debug
option which outputs tostdout
Proposal
Add a way to format a file and dump the formatted contents to stdout without touching the file.
I see several ways of achieving this:
-d/--debug
option fromisort
-
as input filename and then forcing output tostdout
, likeblack
does.-o/--output <filename>
option to write to a different output file, potentially allowing-
to indicate that outputs need to go tostdout
My preferred option here would be number 3, or a combination of 2 and 3, since this is the one that provides more flexibility.