Text of code.visualstudio.com › docs › languages › markdown as Styx crawled it on Oct 9, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Markdown and Visual Studio Code

AI agents: See llms.txt for documentation discovery and navigation. Documentation articles are also available as Markdown by appending .md to the article URL. 🎬 Watch The Story of VS Code! VS Code is now on Instagram, follow @vscode.ig for updates, tips, and more. Rewatch GitHub Copilot Day. Markdown and Visual Studio Code View as Markdown Ask in VS Code Ask in VS Code Insiders Working with Markdown files in Visual Studio Code is simple, straightforward, and fun.

Besides VS Code's basic editing, there are a several Markdown-specific features that help you be more productive. Note : To help get you started with editing Markdown files, you can use the Doc Writer profile template to install useful extensions (spell checker, Markdown linter) and configure appropriate setting values. Editing Markdown Document outline The Outline view is a separate section in the bottom of the File Explorer.

When expanded, it shows the symbol tree of the currently active editor. For Markdown files, the symbol tree is the Markdown file's header hierarchy. The Outline view is a great way to review your document's header structure and outline. Snippets for Markdown VS Code includes some useful snippets that can speed up writing Markdown. This includes snippets for code blocks, images, and more. Press ⌃Space (Windows, Linux Ctrl+Space ) (Trigger Suggest) while editing to see a list of suggested Markdown snippets.

You can also use the dedicated snippet picker by selecting Insert Snippet in the Command Palette. Tip: You can add in your own User Defined Snippets for Markdown. Take a look at User Defined Snippets to find out how. Go to header in file Use ⇧⌘O (Windows, Linux Ctrl+Shift+O ) to quickly jump to a header in the current file. You can browse through all headers in the file or start typing a header name to find just the one you are after.

Once you've found the header you what, press Enter to move your cursor to it. Press Esc to cancel jumping to the header. Go to header in workspace Use ⌘T (Windows, Linux Ctrl+T ) to search through headers across all Markdown files in the current workspace. Start typing a header name to filter down the list and find the header you are after. Path completions Path completions help with create links to files and images.

These paths are shown automatically by IntelliSense as you type the path of an image or link, and can also be manually requested by using ⌃Space (Windows, Linux Ctrl+Space ) . Paths starting with / are resolved relative to the current workspace root, while paths staring with ./ or without any prefix are resolved relative to the current file. Path suggestions are automatically shown when you type / or can be manually invoked by using ⌃Space (Windows, Linux Ctrl+Space ) .

Path IntelliSense can also help you link to headers within the current file or within another Markdown file. Start the path with # to see completions for all the headers in the file (depending on your settings, you might need to use ⌃Space (Windows, Linux Ctrl+Space ) to see these): You can disable path IntelliSense with "markdown.suggest.paths.enabled": false . Creating links to a header in another file 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: Accept one of these completions to insert the full link to that header, even if it's in another file: You can configure if/when workspace header completions show with the markdown.suggest.paths.includeWorkspaceHeaderCompletions Open in VS Code Open in VS Code Insiders 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 might be a slight delay the first time they are requested, especially for workspaces with lots of Markdown files.

Inserting images and links to files In addition to path completion , VS Code also supports a few other ways to insert images and file links into your Markdown documents: You can Drag and drop a file from VS Code's Explorer or from your operating system into a Markdown editor. Start by dragging a file from VS Code's Explorer over your Markdown code and then hold down Shift to start dropping it into the file. The preview cursor shows where it will be inserted when you drop it.

If you prefer using the keyboard, you can also Copy and paste a file or image data into a Markdown editor. When you paste a file, a link to a file, or a URL, you can choose to insert a Markdown link or to include the link as plain text. Or you can use the Markdown: Insert Image from Workspace command to insert images and Markdown: Insert Link to File in Workspace to insert file links. Inserted images use Markdown image syntax ![](path/to/image.png) .

Links insert a normal Markdown link [](path/to/file.md) . By default VS Code automatically copies dropped or pasted images outside of the workspace into your workspace. The markdown.copyFiles.destination Open in VS Code Open in VS Code Insiders setting controls where the new image file should be created. This setting maps globs that match on the current Markdown document to image destinations. The image destinations can also use some simple variables.

See the markdown.copyFiles.destination Open in VS Code Open in VS Code Insiders setting description for information about the available variables. For example, if you want every Markdown file under /docs in your workspace to put new media files into an images directory specific to the current file, you can write: "markdown.copyFiles.destination" : { "/docs/**/*" : "images/${documentBaseName}/" } Now when a new file is pasted in /docs/api/readme.md , the image file is created at /docs/api/images/readme/image.png .

You can even use simple regular expressions to transform variables in a similar way to snippets . For example, this transform uses only the first letter of the document file name when creating the media file: "markdown.copyFiles.destination" : { "/docs/**/*" : "images/${documentBaseName/(.).*/$1/}/" } When a new file is pasted into /docs/api/readme.md , the image is now created under /docs/api/images/r/image.png . Generating alt text for images You can use AI to generate or update alt text for images in Markdown files.

To generate alt text: Make sure you have set up Copilot in your VS Code environment. You can get started with Copilot for free. Open a Markdown file. Put the cursor on an image link. Select the Code Action (lightbulb) icon and select Generate alt text . If you already have an alt text, select the Code Action, and select Refine alt text . Smart selection Smart selection lets you quickly expand and shrink selection in Markdown documents.

This can be used to quickly select entire block elements (such as code blocks or tables) and to select the entire contents of a header section in the Markdown file. Smart selection uses the following commands: Expand: ⌃⇧⌘→ (Windows, Linux Shift+Alt+Right ) Shrink: ⌃⇧⌘← (Windows, Linux Shift+Alt+Left ) Selection applies to the following, and follows a traditional hierarchical pattern: Headers Lists Block quotes Fenced code blocks Html code blocks Paragraphs Link validation Link validation checks local links in your Markdown code to make sure they are valid.

This can catch common mistakes, such linking to a header that was renamed or to a file that no longer exists on disk. Link validation is off by default. To enable it, set "markdown.validate.enabled": true . VS Code then analyzes Markdown links to headers, images, and other local files. Invalid links are reported as either warnings or errors. All link validation happens locally and th

The rest of this page is on the live site.