Skip to content

Instantly share code, notes, and snippets.

@lisaross
Last active June 19, 2023 11:30
Show Gist options
  • Save lisaross/4b5ac90f3ebc9815f444833e4df816de to your computer and use it in GitHub Desktop.
Save lisaross/4b5ac90f3ebc9815f444833e4df816de to your computer and use it in GitHub Desktop.
Markdown Linting using Pandoc

pandoc -t gfm --atx-headers --reference-location=block --toc -s -o filename-new.md filename.md

  • Added as snippet to textexpander with fillin for filename
  • saves in same directory
  • uses github markdown syntax

using with vscode "Run on Save" plugin

  • on every save of markdown file, a new file is created that is compiled into linted version.
  • install pandoc
  • set up so task-lists compile properly with lua filter
  • create ~/.pandoc/filters directory
  • put filters from https://github.com/pandoc/lua-filters in that folder
  • add the following to vscode settings configuration:
"emeraldwalk.runonsave": {
    "commands": [
      {
        "match": "\\.md$",
        "cmd": "pandoc -t markdown --atx-headers --lua-filter=task-list.lua --reference-location=block --toc -s -o ${fileDirname}/${fileBasenameNoExt}-new.md ${fileDirname}/${fileBasenameNoExt}.md"
      }
    ]
  }
@reagle
Copy link

reagle commented Sep 15, 2021

I don't think this is linting so much as having a canonical form...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment