Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

MDX extension for Visual Studio Code

License

NotificationsYou must be signed in to change notification settings

mdx-js/mdx-analyzer

Repository files navigation

BuildCoverageSponsorsBackersChat

This repository contains the code to provide editor tooling support forMDX.

Contents

Workspaces

This repository contains the following workspaces:

Use

TypeScript

MDX doesn’t support TypeScript syntax, but it does supporttypes in JSDoc.

MDX type checking support is similar to JavaScript support.By default, type hints are subtle.To enable strict type checking, you need to specifymdx.checkMdx intsconfig.json:

{"compilerOptions": {//  },"mdx": {// Enable strict type checking in MDX files."checkMdx":true  }}

Props

TheProps type is a special type which is used to determine the type used forprops.For example:

{/**  *@typedefProps  *@property{string}name  *   Who to greet.*/}#Hello{props.name}

MDXProvidedComponents

The special typeMDXProvidedComponents is used to determine which componentsareprovided.For example:

{/**  *@typedefMDXProvidedComponents  *@property{typeof import('../components/Planet.js').Planet}Planet*/}<Planetname="Earth" />

You can also define this type externally, and import it into your MDX file.Based on aNext.js example:

// mdx-components.tsimport{Planet}from'./components/Planet.js'constcomponents={  Planet}exporttypeMDXProvidedComponents=typeofcomponentsexportfunctionuseMDXComponents():MDXProvidedComponents{returncomponents}

Then in your MDX file:

{/**  *@import {MDXProvidedComponents} from '../mdx-components.js'*/}<Planetname="Earth" />

Another alternative is to define theMDXProvidedComponents type globally.This way you don’t have to defineMDXProvidedComponents in each MDX file.Based on aNext.js example:

// mdx-components.tsimport{Planet}from'./components/Planet.js'constcomponents={  Planet}declare global{typeMDXProvidedComponents=typeofcomponents}exportfunctionuseMDXComponents():MDXProvidedComponents{returncomponents}

Now you can write the following MDX with full type safety anywhere:

<Planetname="Earth" />

Plugins

This extension supports remark parser plugins.Plugins can be defined in an array of strings or string / options tuples.These plugins can be defined intsconfig.json and will be resolved relative tothat file.Transformers such asremark-mdx-frontmatter are notsupported yet.Support is tracked in#297.

For example, to supportfrontmatter with YAML and TOML andGFM:

{"compilerOptions": {//  },"mdx": {"plugins": [      ["remark-frontmatter",        ["toml","yaml"]      ],"remark-gfm"    ]  }}

For a more complete list, seeremark plugins.

Contribute

See§ Contribute on our site for ways to get started.See§ Support for ways to get help.

This project has acode of conduct.By interacting with this repository, organization, or community you agree toabide by its terms.

Sponsor

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?

License

MIT ©JounQin@1stG.me


[8]ページ先頭

©2009-2025 Movatter.jp