2022-04-20

How to Enable Word Wrap on Only MDX in VS Code

I love editing in VS Code, but I couldn't get my MDX files to wrap on a specific column width without affecting all my other files. I want my MDX files to wrap because that's how I write blog posts, but I don't want any of my JS files to wrap because it makes it much harder to read. After doing some research, I was able to piece together a solution.

Paste this code in your settings.json file

    "[mdx]": {
        "editor.wordWrap": "wordWrapColumn",
        "editor.quickSuggestions": false,
        "editor.wordWrapColumn": 80,
    },

If you use markdown instead of MDX, change the [mdx] to [Markdown].

Learn five new things in five minutes or less.
Get my weekly email that shares an anthology of ideas and stories from history, science, philosophy, and more. Read previous editions here.