What is “fragment link navigation for Markdown” in Visual Studio Code?

匆匆过客 提交于 2020-05-31 04:16:05

问题


The February 2017 (version 1.10) release notes for Visual Studio Code describes something they call "Fragment link navigation for Markdown." Here is the description:

"Links to Markdown files that include a fragment will now try to open the file at the corresponding header:

* [Section](#_header)
* [Another file](./other_file#_header)

# Header
...

This allows quickly navigating documentation directly within the VS Code editor."

I've searched for any more information on this topic but haven't found anything. Fragments in Markdown? I didn't know that was possible. Can someone point me to more information?


回答1:


I implemented this feature. Sorry for the unclear documentation

In 1.9, we added support for ctrlclick on links in the markdown editor to open the corresponding document.

Ctrl clicking [this link destination](./other_file.md) will open `other_file.md` in the editor

1.10 added support for navigating to a specific header in the current markdown file

Ctrl clicking [this link destination](#header) will scroll to # Header

... 

# Header

You can also use this across files:

Ctrl clicking [this link destination](./other-file.md#header) will open `other-file.md` and scroll to `#header`

This allows navigating markdown based documentation entirely within the editor. Here's the feature in action:


If you run into any bugs or have any feature suggestions for VSCode markdown support, please let us know: https://github.com/Microsoft/vscode/issues/new




回答2:


In addition to the above, vscode v1.45 will be adding support to open folders referenced in markdown links in the explorer bar. Akin to "Reveal In SideBar" but for folders.

https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_45.md#markdown-link-to-folders

Markdown link to folders

Editor links in markdown files and links in the markdown preview can now point to folders. Clicking on one of these links will reveal the target folder in VS Code's explorer.



来源:https://stackoverflow.com/questions/42569143/what-is-fragment-link-navigation-for-markdown-in-visual-studio-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!