{"id":13678056,"url":"https://github.com/rspack-contrib/rsbuild-plugin-mdx","last_synced_at":"2025-04-14T10:20:39.290Z","repository":{"id":246749987,"uuid":"822482050","full_name":"rspack-contrib/rsbuild-plugin-mdx","owner":"rspack-contrib","description":"An Rsbuild plugin to provide support for MDX.","archived":false,"fork":false,"pushed_at":"2025-04-01T03:27:18.000Z","size":248,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-14T03:54:30.348Z","etag":null,"topics":["rsbuild","rsbuild-plugin","rspack"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rspack-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-01T08:34:52.000Z","updated_at":"2025-04-01T03:27:20.000Z","dependencies_parsed_at":"2024-08-07T07:54:43.466Z","dependency_job_id":"a152a7d8-d796-43a3-b004-ab7f9b3e342d","html_url":"https://github.com/rspack-contrib/rsbuild-plugin-mdx","commit_stats":null,"previous_names":["rspack-contrib/rsbuild-plugin-mdx"],"tags_count":3,"template":false,"template_full_name":"rspack-contrib/rsbuild-plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-mdx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-mdx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-mdx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-mdx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rspack-contrib","download_url":"https://codeload.github.com/rspack-contrib/rsbuild-plugin-mdx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860005,"owners_count":21173342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rsbuild","rsbuild-plugin","rspack"],"created_at":"2024-08-02T13:00:49.746Z","updated_at":"2025-04-14T10:20:39.264Z","avatar_url":"https://github.com/rspack-contrib.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Rsbuild Plugins"],"readme":"# @rsbuild/plugin-mdx\n\nAn Rsbuild plugin to provide support for [MDX](https://github.com/mdx-js/mdx/).\n\nMDX lets you use JSX in your markdown content. You can import components, such as interactive charts or alerts, and embed them within your content. This makes writing long-form content with components a blast.\n\n\u003cp\u003e\n  \u003ca href=\"https://npmjs.com/package/@rsbuild/plugin-mdx\"\u003e\n   \u003cimg src=\"https://img.shields.io/npm/v/@rsbuild/plugin-mdx?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"npm version\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"license\" /\u003e\n\u003c/p\u003e\n\n## Usage\n\nInstall:\n\n```bash\nnpm add @rsbuild/plugin-mdx -D\n```\n\nAdd plugin to your `rsbuild.config.ts`:\n\n```ts\n// rsbuild.config.ts\nimport { pluginMdx } from \"@rsbuild/plugin-mdx\";\n\nexport default {\n  plugins: [pluginMdx()],\n};\n```\n\nAfter registering the plugin, you can import `.mdx` or `.md` files as components in your code.\n\n## Options\n\nIf you need to customize the compilation behavior of MDX, you can use the following configs.\n\n### mdxLoaderOptions\n\nOptions passed to `@mdx-js/loader`, please refer to [@mdx-js/loader documentation](https://www.npmjs.com/package/@mdx-js/loader) for detailed usage.\n\n- **Type:** `MdxLoaderOptions`\n- **Default:** `{}`\n- **Example:**\n\n```ts\npluginMdx({\n  mdxLoaderOptions: {\n    // Use Vue JSX\n    jsxImportSource: \"vue\",\n  },\n});\n```\n\n### extensions\n\nSpecify the file extensions to be compiled with MDX loader, including .md files and .mdx files by default.\n\n- **Type:** `string[]`\n- **Default:** `['.mdx', '.md']`\n\nFor example, to only compile .mdx files, you can set it as:\n\n```ts\npluginMdx({\n  extensions: [\".mdx\"],\n});\n```\n\n## Type Declarations\n\nIn a TypeScript project, you need to add type definitions for `*.mdx` files so that TypeScript can recognize them correctly.\n\nCreate `env.d.ts` in the `src` directory and add the following content:\n\n```ts title=\"src/env.d.ts\"\ndeclare module \"*.md\" {\n  let MDXComponent: () =\u003e JSX.Element;\n  export default MDXComponent;\n}\ndeclare module \"*.mdx\" {\n  let MDXComponent: () =\u003e JSX.Element;\n  export default MDXComponent;\n}\n```\n\n## License\n\n[MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-mdx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-mdx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-mdx/lists"}