2

I've started using VisualStudio Code and Markdown as a note-taking tool - something akin to Zettelkasten. As part of this note-taking system, notes should always be linking to other notes/files.

As recovering developer I start to write: [Decision Making Techniques](.\ ) - when I type .\ and then ctrl+space I expect a list of filenames. Instead, I get a list of words.

Is there a simple? (gasp elegant way?) to have IntelliSense recognize filenames as distinct kind of thing in Markdown mode?

Mark Levison
  • 788
  • 3
  • 9
  • 22
  • Interesting question, but is this not more suited to superuser.com? – DocRoot Jan 21 '20 at 02:43
  • @DocRoot It's curious - you might right. I got here only VS Code FAQ: https://code.visualstudio.com/Docs/supporting/FAQ points here from a sidebar. Just for fun I searched both Markdown and VS Code in both stackoverflow and superuser.com. Both have more questions/answers here. My guess - both are ok. – Mark Levison Jan 22 '20 at 03:19

4 Answers4

2

Strangely, I'm now able to answer my own. The plugin Markdown All in One has this facility built in. I suspect that Path Autocomplete would have worked as well.

Mark Levison
  • 788
  • 3
  • 9
  • 22
  • 1
    Markdown all in one works, path autocomplete not (for me at least). I suspect it's because markdown doesn't surround pathes with quotes. – Giezi Jul 08 '21 at 21:07
  • Cool. My goal was to leave breadcrumbs behind for others to follow. It may be that Markdown All in One now supports this. 18 mths ago it didn't. My own Zettelkasten has migrated to a tool called TheBrain. – Mark Levison Jul 09 '21 at 16:03
2

Intellisense support can be controlled by Extensions, so as has been correctly pointed out, a few extensions add this capability to your workspace.

A more technical answer is also probably required and you can see an example commit that adds autocomplete support for markdown here.

In general, you will need to:

  1. populate a provider with completion items.
  2. get a handle to the vscode extension context.
  3. add your provider to the list of supported vscode completion providers.

Similar to foam, Dendron also builds in markdown link autocomplete and also adds in lots of features like publishing, flexible hierarchies, preview support etc.

For additional docs, see the vscode api.

Kiran
  • 383
  • 2
  • 13
  • 1
    FWIW I wasn't really looking a whole ecosystem just the building block. Foam and Dendron both seem interesting but are bigger than I intended. – Mark Levison Jul 09 '21 at 16:09
  • 1
    Oh yeah, absolutely. I also wanted to address the "if I want to add markdown autocomplete to my extension, how would I do it question". – Kiran Jul 12 '21 at 03:13
2

And speaking of clever ways to make markdown links, vscode 1.76 is adding the ability to easily make a link to any header in the same file or another markdown file. See markdown header links: v1.76 Release Notes:

Need to link to a header in another Markdown document but don't remember or want to type out the full file path? Try using workspace header completions! To start, just type ## in a Markdown link to see a list of all Markdown headers from the current workspace

(my demo):

markdown header links suggestions

You can configure if/when workspace header completions show with the markdown.suggest.paths.includeWorkspaceHeaderCompletions setting. Valid setting values are:

  • onDoubleHash (the default) — Show workspace header completions only after you type ##.
  • onSingleOrDoubleHash — Show workspace header completions after you type # or ##.
  • never — Never show workspace header completions.

Keep in mind that finding all headers in the current workspace can be expensive, so there may be a slight delay the first time they are requested, especially for workspaces with lots of Markdown files.


In the Insiders Build v1.64 there is now path intellisense for markdown links.

Enable this setting: markdown.suggest.paths.enabled default is true

See Commit: Add basic markdown link completions

Only normal links for now. Will add reference links later. Should support the forms:

  • [](dir/file.md)
  • [](./dir/file.md)
  • [](/root-dir/file.md)
  • [](#header)
  • [](./dir/file.md#header)

See also https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_64.md#markdown-path-intellisense

Mark
  • 143,421
  • 24
  • 428
  • 436
1

Foam is a personal knowledge management and sharing system inspired by Roam Research, built on Visual Studio Code and GitHub.

DirtyF
  • 661
  • 7
  • 10
  • FWIW I wasn't really looking a whole ecosystem just the building block. Foam and Dendron both seem interesting but are bigger than I intended. – Mark Levison Jul 09 '21 at 16:09