VS Code Markdown Notes
Use [[wiki-links]]
and #tags
for fast-navigation between notes kept in in a VS Code workspace. Quickly create new notes from a Title Case Note Name.
There are many great note-taking applications (Notational Velocity, nvalt, Bear, FSNotes), but few of them offer the extensibility of VS Code and the ability to use Vim bindings for editing notes.
This extension provides a number of the best features invented by these other great apps.
You can install it from the VSCode Marketplace. See also my other customizations for note-taking in this blog post: Suping Up VS Code as a Markdown Notebook.
[[wiki-links]]
A popular feature in Roam Research and Bear is the ability to quickly reference other notes using "Cross-Note Links" in the [[wiki-link]]
style.
VS Code Markdown notes provides syntax highlighting, auto-complete, Go to Definition (editor.action.revealDefinition
), and Peek Definition (editor.action.peekDefinition
) support for wiki-links to notes in a workspace.
By default, the extension assumes each markdown file in a workspace has a unique name, so that note.md
will resolve to the file with this name, regardless of whether or not this file exists in any subdirectory path. This tends to be a bit cleaner, but if you want support for multiple files with the same name, in settings.json
set "vscodeMarkdownNotes.workspaceFilenameConvention": "relativePaths"
, and you'll get completions like note1/note.md
and ../note2/note.md
.
#tags
Syntax highlighting for #tags
.
New Note command
Provides a command for quickly creating a new note.
You can bind this to a keyboard shortcut by adding to your keybindings.json
:
{
"key": "al+shift+n",
"command": "vscodeMarkdownNotes.newNote",
},
Screenshots
uniqueFilenames
Intellisense Completion for Wiki Links,
relativePaths
Intellisense Completion for Wiki Links,
Syntax Highlighting for Tags and Wiki Links
Peek and Go to Definition for Wiki Links
Create New Note On Missing Go To Definition
New Note Command
Peek References to Wiki Links
Peek References to Tag
Find All References to Wiki Links
Find All References to Tag
cmd+shift+f
to Search Workspace for Notes with Tag
dev
Run npm install
first.
FAQ
- "Autocomplete / Intellisense is not working - why?"
- Quick suggestions are not enabled by default in Markdown, so you have to manually
triggerSuggest
OR put this in settings.json:
"[markdown]": { "editor.quickSuggestions": true // If you turn this on and DO NOT want suggestions // for non-wiki-link, non-tag words, // You may also want to add this setting: // "editor.wordBasedSuggestions": false, }
- Quick suggestions are not enabled by default in Markdown, so you have to manually
- "New note is not working - why?"
- New Note works only when you are in a workspace. Look here for more information on workspaces in VS Code.
Known Issues
- The
ctrl+o
VSCodeVim jumplist shortcut does not return you to the correct place after using "Go to Definition" (ctrl+]
): VSCodeVim/Vim#3277 (The VSCodeGo Back
command (ctrl+-
) does work, however.) - This extension sets the
wordPattern
for 'markdown' in order to (1) enable proper completion of relative paths and (2) make it such that if youcmd+shift+f
on a#tag
the search will prefill with "#tag" and not just "tag":vscode.languages.setLanguageConfiguration('markdown', { wordPattern: /([\#\.\/\\\w_]+)/ });
TODO
- Provide better support for ignore patterns, eg, don't complete
file.md
if it is withinignored_dir/
- Should we support filename without extension, eg, assume
[[file]]
is a reference tofile.md
? - Should we support links to headings? eg,
file.md#heading-text
?
Development and Release
To create a new release,
npm install
# bump version number in package.json
npm run vpackage # package the release, creates vsix
npm run vpublish # publish to store, see https://code.visualstudio.com/api/working-with-extensions/publishing-extension
# Will prompt for Azure Devops Personal Access Token, get fresh one at:
# https://dev.azure.com/andrewkortina/
# On "Error: Failed Request: Unauthorized(401)"
# see: https://github.com/Microsoft/vscode-vsce/issues/11
# The reason for returning 401 was that I didn't set the Accounts setting to all accessible accounts.
To install the vsix
locally:
- Select Extensions
(Ctrl + Shift + X)
- Open
More Action
menu (ellipsis on the top) and clickInstall from VSIX…
- Locate VSIX file and select.
- Reload VSCode.
Helpful Links
- completion: https://github.com/microsoft/vscode-extension-samples/blob/master/completions-sample/src/extension.ts
- syntax: https://flight-manual.atom.io/hacking-atom/sections/creating-a-legacy-textmate-grammar/
- vscode syntax: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide