A language server for MDX.
- What is this?
- When should I use this?
- Install
- Use
- Examples
- Compatibility
- Security
- Contribute
- Sponsor
- Changelog
- License
This package provides a language server for MDX. The language server provides editor support based on Volar. This includes support for TypeScript as well as some MDX specific features.
You can use this package if you want to enhance your editor for MDX files with features such as autocomplete and error diagnostics. Some editors can consume this package directly, others need a plugin in order to consume this package.
In Node.js (version 16+), install with npm:
npm install @mdx-js/language-server
How to use this package depends on your editor integration.
This package provides the mdx-language-server
CLI.
Because this is based on vscode-languageserver
, the
same transports are supported.
This language server supports all features supported by
volar-service-markdown
and
volar-service-typescript
, plus some additional
features specific to MDX.
The language server supports the following LSP commands:
Toggle delete syntax at the cursor position.
It uses the workspace/applyEdit
command to apply edits.
-
uri
— The URI of the document to apply changes to. -
range
— The current selection range of the user.
null
Toggle emphasis syntax at the cursor position.
It uses the workspace/applyEdit
command to apply edits.
-
uri
— The URI of the document to apply changes to. -
range
— The current selection range of the user.
null
Toggle inline code syntax at the cursor position.
It uses the workspace/applyEdit
command to apply edits.
-
uri
— The URI of the document to apply changes to. -
range
— The current selection range of the user.
null
Toggle strong syntax at the cursor position.
It uses the workspace/applyEdit
command to apply edits.
-
uri
— The URI of the document to apply changes to. -
range
— The current selection range of the user.
null
MDX language server supports the following LSP initialization options:
-
typescript.enabled
(boolean
, default:false
) — If true, enable TypeScript. -
typescript.tsdk
(string
, required) — The path from which to load TypeScript. -
locale
(string
, optional) — The locale to use for TypeScript error messages.
MDX language server supports the following LSP configuration options:
-
mdx.trace.server.verbosity
("off"
|"messages"
|"compact"
|"verbose"
, default:"off"
) — Trace MDX language server requests in the output console. -
mdx.trace.server.format
("text"
|"json"
, default:"text"
) — How to format traced MDX language server requests. -
mdx.validate.validateReferences
("ignore"
|"hint"
|"warning"
|"error"
, default:"warning"
) — Diagnostic level for invalid reference links, e.g.[text][no-such-ref]
. -
mdx.validate.validateFragmentLinks
("ignore"
|"hint"
|"warning"
|"error"
, default:"warning"
) — Diagnostic level for fragments links to headers in the current file that don’t exist, e.g.[text](#no-such-header)
-
mdx.validate.validateFileLinks
("ignore"
|"hint"
|"warning"
|"error"
, default:"warning"
) — Diagnostic level for links to local files that don’t exist, e.g.[text](./no-such-file.png)
. -
mdx.validate.validateMarkdownFileLinkFragments
("ignore"
|"hint"
|"warning"
|"error"
, default:"warning"
) — Diagnostic level for the fragment part of links to other local markdown files, e.g.[text](./no-such-file.png)
. -
mdx.validate.validateUnusedLinkDefinitions
("ignore"
|"hint"
|"warning"
|"error"
, default:"warning"
) — Diagnostic level for link definitions that aren’t used anywhere.[never-used]: http://example.com
. -
mdx.validate.validateDuplicateLinkDefinitions
("ignore"
|"hint"
|"warning"
|"error"
, default:"warning"
) — Diagnostic level for duplicate link definitions. -
mdx.validate.ignoreLinks
(Array<string>
, optional) — Glob of links that should not be validated.
This extension offers type safety for MDX files based on TypeScript’s types in JSDoc. For MDX specific details, see the TypeScript section of the repository readme.
For information on plugin support, see the Plugins section of the repository readme.
MDX language server can be integrated with any server that supports language servers. Does your editor support MDX language server, but is it not in this list? Feel free to add it.
Use unifiedjs.vscode-mdx
to use the MDX language server with
Visual Studio Code.
Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js and 16.0+. Our projects sometimes work with older versions, but this is not guaranteed.
This project uses vscode-languageserver
9, which
implements language server protocol 3.17.4.
It should work anywhere where LSP 3.6.0 or later is implemented.
This package provides IntelliSense for MDX files. Some IntelliSense features modify your source code, for example suggestions and automatic refactors. It is recommended to keep your source code under version control.
See § Contribute on our website for ways to get started. See § Support for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
See § Sponsor on our site for how to help financially.
Vercel |
Motif |
HashiCorp |
GitBook |
Gatsby |
|||||
Netlify |
Coinbase |
ThemeIsle |
Expo |
Boost Note |
Markdown Space |
Holloway |
|||
You? |
Detailed changes for each release are documented in CHANGELOG.md.