npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mdx-js/language-server

v0.5.0

Published

A language server for MDX

Downloads

767

Readme

@mdx-js/language-server

Build Coverage Downloads Sponsors Backers Chat

A language server for MDX.

Contents

What is this?

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.

When should I use this?

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.

Install

In Node.js (version 16+), install with npm:

npm install @mdx-js/language-server

Use

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.

Language server features

This language server supports all features supported by volar-service-markdown and volar-service-typescript, plus some additional features specific to MDX.

Commands

The language server supports the following LSP commands:

mdx.toggleDelete

Toggle delete syntax at the cursor position. It uses the workspace/applyEdit command to apply edits.

Arguments
  • uri — The URI of the document to apply changes to.
  • range — The current selection range of the user.
Returns

null

mdx.toggleEmphasis

Toggle emphasis syntax at the cursor position. It uses the workspace/applyEdit command to apply edits.

Arguments
  • uri — The URI of the document to apply changes to.
  • range — The current selection range of the user.
Returns

null

mdx.toggleInlineCode

Toggle inline code syntax at the cursor position. It uses the workspace/applyEdit command to apply edits.

Arguments
  • uri — The URI of the document to apply changes to.
  • range — The current selection range of the user.
Returns

null

mdx.toggleStrong

Toggle strong syntax at the cursor position. It uses the workspace/applyEdit command to apply edits.

Arguments
  • uri — The URI of the document to apply changes to.
  • range — The current selection range of the user.
Returns

null

Initialize Options

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.

Configuration

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.

TypeScript

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.

Plugins

For information on plugin support, see the Plugins section of the repository readme.

Examples

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.

Visual Studio Code

Use unifiedjs.vscode-mdx to use the MDX language server with Visual Studio Code.

Compatibility

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.

Security

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.

Contribute

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.

Sponsor

See § Sponsor on our site for how to help financially.

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT © Remco Haszing