Search code examples
jsonvisual-studiovisual-studio-codemarkdowncode-snippets

Can we write code snippet for markdown language in Visual Studio Code?


Why markdown language not seems to be supported by code-snippets in vs-code? I've also tried writing "scope: "md" but it also doesn't work.

{
    "Print to console": {
        "scope": "markdown",
        "prefix": "test",
        "body": [
            "console.log('$1');",
            "$2"
        ],
        "description": "description"
    }
}

Solution

  • Create some of the other snippet files like html.json.

    Save this file with File | Save As... as markdown.json in the same directory.

    Fill in your snippet.

    In the Markdown file type your snippet prefix and press CtrlSpace and select the snippet you want.

    It seems there is not a completion provider that shows the possible completions while you type or it is not enabled by default.