VS Code as a markdown editor

When I write anything I prefer to do it in markdown then export it to MS Word, Evernote or WordPress. VS Code makes a great markdown editor with a couple of extensions.

Extensions

Markdown All in One

Seems like an obvious place to start. Adds useful shortcuts, ToC, table formatting and some other useful features.

markdownlint

This adds some useful linting, the default rule set is good but I need to make some changes…

  • MD009 – Allow 2 trailing spaces to signify a line break
  • MD013 – Allow long lines, I prefer to allow wordwrap to deal with this in markdown
  • MD024 – Allow duplicate headers, I often want repeating subheaders in documents

{} User Settings:

{
  "markdownlint.config": {
    "default": true,
    "MD009": {
      "br_spaces": 2
    },
    "MD013": false,
    "MD024": false
  }
}

vscode-pandoc

This provides the export to Word in addition to PDF and HTML.

Disable Prettier

I really like Prettier but in v1 it ‘fixes’ unordered bullets in markdown from ‘-’ to ‘*’. There should be a way to configure that in v2 but until then I’ll turn it off for markdown.

{} User Settings:

{
  "prettier.disableLanguages": [
    "vue",
    "markdown",
  ]
}

Mobile editing

I keep markdown docs in a folder in Dropbox and use Byword on IOS to create notes when I don’t have a laptop handy. Byword has functionality to publish to Evernote and WordPress as well.

.vscode/extensions.json

{
  "recommendations": [
    "yzhang.markdown-all-in-one",
    "DavidAnson.vscode-markdownlint",
    "DougFinke.vscode-pandoc"
  ]
}

Shortcuts to remember

  • ctrl } – Header
  • ctrl { – Remove Header
  • ctrl shift v – toggle preview

Evernote

I have not yet found a good way to export notes to Evernote, there are a couple of extensions for VS Code but there are issues with the required Evernote user extensions. I can use Byword on IOS or OSX to publish to Evernote but would prefer to be able to do so with VS Code. There is a VS Code extension that will copy markdown as rich text but it is Windows only.

WordPress

For simple posts containing mostly text, pasting the markdown directly into the WordPress text box seems like it should be sufficient. For longer posts, probably best to publish with Byword again but, even with Byword, code snippets could use some more work (will use this method to publish this post).

Open with Alfred

Lastly I want a shortcut in Alfred to open the markdown folder in IOS so I have associated the keyword ‘md’ with this apple script:

on alfred_script(q)
  tell application "Visual Studio Code"
    open "/Users/jp/Dropbox/Apps/Byword"
  end tell
end alfred_script

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.