{"id":13483640,"url":"https://github.com/micromark/micromark-extension-mdx","last_synced_at":"2025-05-02T07:32:16.458Z","repository":{"id":57296678,"uuid":"319735349","full_name":"micromark/micromark-extension-mdx","owner":"micromark","description":"micromark extension to support MDX (agnostic to JavaScript)","archived":false,"fork":false,"pushed_at":"2024-09-02T14:31:46.000Z","size":64,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-29T23:13:15.498Z","etag":null,"topics":["expression","jsx","markdown","md","mdx","mdxjs","micromark","micromark-extension"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","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/micromark.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},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2020-12-08T19:08:03.000Z","updated_at":"2024-09-02T14:31:49.000Z","dependencies_parsed_at":"2024-06-18T21:20:46.074Z","dependency_job_id":"b9aa8e6a-0f72-4b2d-a786-6f3b3779cf50","html_url":"https://github.com/micromark/micromark-extension-mdx","commit_stats":{"total_commits":44,"total_committers":1,"mean_commits":44.0,"dds":0.0,"last_synced_commit":"352509ab367a22861acd742e3b9ad479c6515bd0"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micromark%2Fmicromark-extension-mdx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micromark%2Fmicromark-extension-mdx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micromark%2Fmicromark-extension-mdx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micromark%2Fmicromark-extension-mdx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micromark","download_url":"https://codeload.github.com/micromark/micromark-extension-mdx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224160257,"owners_count":17265943,"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":["expression","jsx","markdown","md","mdx","mdxjs","micromark","micromark-extension"],"created_at":"2024-07-31T17:01:13.617Z","updated_at":"2024-11-12T16:04:06.428Z","avatar_url":"https://github.com/micromark.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["JavaScript"],"sub_categories":[],"readme":"# micromark-extension-mdx\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[micromark][] extensions to support [MDX][mdxjs], unaware of JavaScript.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When to use this](#when-to-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`mdx()`](#mdx)\n* [Authoring](#authoring)\n* [Syntax](#syntax)\n* [Errors](#errors)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package contains an extension that adds support for the syntax enabled\nby [MDX][mdxjs] to [`micromark`][micromark].\nThis extension is used inside MDX.\nIt supports expressions, JSX, and turns some markdown features off.\nIt is not aware of the syntax of JavaScript inside expressions and does not\nsupport export/imports.\n\n## When to use this\n\nYou can use this extension when you are working with [`micromark`][micromark].\n\nThis project is useful when you want to support MDX, unaware of JavaScript, for\nexample because expressions can include Rust or variables or whatnot.\nIf you want to be aware of JavaScript, use\n[`micromark-extension-mdxjs`][micromark-extension-mdxjs].\n\nAlternatively, you can also use the underlying syntax extensions separately:\n\n* [`micromark-extension-mdx-expression`][micromark-extension-mdx-expression]\n  — support MDX expressions\n* [`micromark-extension-mdx-jsx`][micromark-extension-mdx-jsx]\n  — support MDX JSX\n* [`micromark-extension-mdx-md`][micromark-extension-mdx-md]\n  — turn some CommonMark features off\n\nWhen you need a syntax tree, combine this package with\n[`mdast-util-mdx`][mdast-util-mdx].\n\nAll these packages are used in [`remark-mdx`][remark-mdx], which focusses on\nmaking it easier to transform content by abstracting these internals away.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install micromark-extension-mdx\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {mdx} from 'https://esm.sh/micromark-extension-mdx@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {mdx} from 'https://esm.sh/micromark-extension-mdx@2?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n```js\nimport {micromark} from 'micromark'\nimport {mdx} from 'micromark-extension-mdx'\n\nconst output = micromark('a \u003cb /\u003e c {1 + 1} d', {extensions: [mdx()]})\n\nconsole.log(output)\n```\n\nYields:\n\n```html\n\u003cp\u003ea  c  d\u003c/p\u003e\n```\n\n…which is useless: go to a syntax tree with\n[`mdast-util-from-markdown`][mdast-util-from-markdown] and\n[`mdast-util-mdx`][mdast-util-mdx] instead.\n\n## API\n\nThis package exports the identifier [`mdx`][api-mdx].\nThere is no default export.\n\nThe separate extensions support the [`development` condition][development].\nRun `node --conditions development module.js` to get instrumented dev code.\nWithout this condition, production code is loaded.\n\n### `mdx()`\n\nCreate an extension for `micromark` to enable MDX syntax, unaware of JavaScript.\n\n###### Returns\n\nExtension for `micromark` that can be passed in `extensions` to enable MDX\nsyntax, unaware of JavaScript ([`Extension`][micromark-extension]).\n\n## Authoring\n\nFor recommendations on how to author MDX, see each corresponding readme:\n\n* [expressions](https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression#authoring)\n* [JSX](https://github.com/micromark/micromark-extension-mdx-jsx#authoring)\n* [CommonMark features not in MDX](https://github.com/micromark/micromark-extension-mdx-md#authoring)\n\n## Syntax\n\nFor info on the syntax of these features, see each corresponding readme:\n\n* [expressions](https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression#syntax)\n* [JSX](https://github.com/micromark/micromark-extension-mdx-jsx#syntax)\n* CommonMark features not in MDX: n/a\n\n## Errors\n\nFor info on what errors are thrown, see each corresponding readme:\n\n* [expressions](https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression#errors)\n* [JSX](https://github.com/micromark/micromark-extension-mdx-jsx#errors)\n* CommonMark features not in MDX: n/a\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`micromark-extension-mdx@^2`, compatible with Node.js 16.\n\nThis package works with `micromark` version `3` and later.\n\n## Security\n\nThis package is safe.\n\n## Related\n\n* [`micromark-extension-mdxjs`][micromark-extension-mdxjs]\n  — support MDX aware of JS\n* [`mdast-util-mdx`][mdast-util-mdx]\n  — support MDX in mdast\n* [`remark-mdx`][remark-mdx]\n  — support MDX syntax in remark\n\n## Contribute\n\nSee [`contributing.md` in `micromark/.github`][contributing] for ways to get\nstarted.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/micromark/micromark-extension-mdx/workflows/main/badge.svg\n\n[build]: https://github.com/micromark/micromark-extension-mdx/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-mdx.svg\n\n[coverage]: https://codecov.io/github/micromark/micromark-extension-mdx\n\n[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-mdx.svg\n\n[downloads]: https://www.npmjs.com/package/micromark-extension-mdx\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=micromark-extension-mdx\n\n[size]: https://bundlejs.com/?q=micromark-extension-mdx\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/micromark/micromark/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esmsh]: https://esm.sh\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[contributing]: https://github.com/micromark/.github/blob/main/contributing.md\n\n[support]: https://github.com/micromark/.github/blob/main/support.md\n\n[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[typescript]: https://www.typescriptlang.org\n\n[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions\n\n[micromark]: https://github.com/micromark/micromark\n\n[micromark-extension]: https://github.com/micromark/micromark#syntaxextension\n\n[micromark-extension-mdxjs]: https://github.com/micromark/micromark-extension-mdxjs\n\n[micromark-extension-mdx-expression]: https://github.com/micromark/micromark-extension-mdx-expression\n\n[micromark-extension-mdx-jsx]: https://github.com/micromark/micromark-extension-mdx-jsx\n\n[micromark-extension-mdx-md]: https://github.com/micromark/micromark-extension-mdx-md\n\n[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx\n\n[remark-mdx]: https://mdxjs.com/packages/remark-mdx/\n\n[mdxjs]: https://mdxjs.com\n\n[api-mdx]: #mdx\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicromark%2Fmicromark-extension-mdx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicromark%2Fmicromark-extension-mdx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicromark%2Fmicromark-extension-mdx/lists"}