Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I edit Markdown's language configuration in Visual Studio Code?

I really like the auto surround feature in VS Code, where you highlight some text and type a character like ( or [ and it surrounds your highlighted text with ( ) or [ ], respectively. I recently downloaded a VS Code extension that enables LaTeX formatting with Markdown files, and now I want to add the character $ as one of these "auto-surrounding" characters (statements surrounded by $ characters are rendered with LaTeX).

I have done some digging in the VS Code documentation and around the web, but I can't find where I could manually add my own custom characters for auto-surrounding. This page in the official documentation seems most promising. I can't figure out where this file lives though (or if there is a way for me as a user to edit it).

like image 926
Evan Smith Avatar asked Oct 29 '25 15:10

Evan Smith


1 Answers

This isn't something that you can change via preferences. You'd need to modify the Markdown extension itself. This is entirely possible, but as VSCode updates it will overwrite your changes and you'll have to make them again.

Find the markdown-basics extension in your VSCode installation. On my Windows 10 machine, it is in C:\Users\me\Local\Programs\Microsoft VS Code\resources\app\extensions\markdown-basics\. If you're on another operating system, look for the resources/app/extensions/markdown-basics/ directory inside your VSCode installation path.

Open up the language-configuration.json file. This will probably have been minified, so I suggest you format the document via the context menu, a keyboard shortcut (Shift+Alt+F on Windows), or the command palette. Then add

[
  "$",
  "$"
]

to the existing array of surroundingPairs. Save, and you should be good to go.

While you're in there, you might also want to update the autoClosingPairs, e.g. by adding this:

{
  "open": "$ ",
  "close": " $"
}

You might need to restart VSCode for this to take effect, e.g. if the plugin was already loaded.

like image 171
Chris Avatar answered Oct 31 '25 11:10

Chris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!