27 points · by shurcooL · 12y ago · 21 comments
$ pandoc -t markdown --atx-headers --no-wrap uglyfile.md
That has been my go to way to clean up some of my crufty markdown formatting. I have a variant `spretyymd` that pipes the output to aspell. Obviously this does not replace the file in situ or create diffs. In situ pipe processing is always risky sounding enough that I never thought about doing it.I wish someone would write an updated par with better documentation.
I've been dogfooding this for about a month for all my Markdown (mostly GitHub README.mds, comments to issues, etc.), and by now it's stable to cover my (admittedly, more basic) use cases of Markdown. I don't have explicit support for exotic Markdown features like tables at this time.
The Atom package has 100+ downloads by now, and I've only had 1 issue reported so far, so I'd be very curious to actually learn how many other people use it.
https://raw.githubusercontent.com/shurcooL/atom-markdown-for...
There are also some examples in tests:
https://github.com/shurcooL/markdownfmt/blob/d472cbc9d6118d6...
What do you mean by "unwrapping"? Can you give an example please. I don't think it should be doing any unwrapping; blockquotes should be preserved (and nicely formatted) [1].
> You went way past that line when you removed the empty line at the end of the file.
It makes sure the last line has an ending newline, nothing more, nothing less. Any extra newlines are not visible in the generated HTML.
[1] https://github.com/shurcooL/markdownfmt/blob/d472cbc9d6118d6...