shellmarkdowngithub-flavored-markdownreformatting

Reformat Markdown files to a specific code style


I'm working on a book which had a couple of people writing and editing the text. Everything is Markdown. Unfortunately, there is a mix of different styles and lines widths. Technically this isn't a problem but it's not nice in terms of aesthetics.

What is the best way to reformat those files in e.g. GitHub markdown style? Is there a shell script for this job?


Solution

  • You might want to look at Pandoc; it understands several flavors of Markdown.

    pandoc -f markdown -t gfm foobar.md
    

    Having written a markup converter years ago in Perl, I would not want to approach such a task without a decent lexical analyzer, which is a bit beyond shell scripting.