-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules/ | |
*.log | ||
.DS_Store | ||
yarn.lock | ||
!/index.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type {Options as MdxExpressionOptions} from 'micromark-extension-mdx-expression' | ||
|
||
export {mdxjs} from './lib/index.js' | ||
|
||
/** | ||
* Configuration for `mdxjs` of `micromark-extension-mdxjs`. | ||
*/ | ||
export interface Options extends MdxExpressionOptions {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,2 @@ | ||
/** | ||
* @typedef {import('micromark-extension-mdx-expression').Options} Options | ||
* @typedef {import('micromark-util-types').Extension} Extension | ||
*/ | ||
|
||
import {Parser} from 'acorn' | ||
import acornJsx from 'acorn-jsx' | ||
import {mdxExpression} from 'micromark-extension-mdx-expression' | ||
import {mdxJsx} from 'micromark-extension-mdx-jsx' | ||
import {mdxMd} from 'micromark-extension-mdx-md' | ||
import {mdxjsEsm} from 'micromark-extension-mdxjs-esm' | ||
import {combineExtensions} from 'micromark-util-combine-extensions' | ||
|
||
/** | ||
* Create an extension for `micromark` to enable MDX syntax. | ||
* | ||
* @param {Options | null | undefined} [options] | ||
* Configuration (optional). | ||
* @returns {Extension} | ||
* Extension for `micromark` that can be passed in `extensions` to enable MDX | ||
* syntax. | ||
*/ | ||
export function mdxjs(options) { | ||
const settings = Object.assign( | ||
{ | ||
acorn: Parser.extend(acornJsx()), | ||
acornOptions: {ecmaVersion: 2024, sourceType: 'module'}, | ||
addResult: true | ||
}, | ||
options | ||
) | ||
|
||
return combineExtensions([ | ||
mdxjsEsm(settings), | ||
mdxExpression(settings), | ||
mdxJsx(settings), | ||
mdxMd() | ||
]) | ||
} | ||
// Note: types exposed from `index.d.ts`. | ||
export {mdxjs} from './lib/index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* @import {Options} from 'micromark-extension-mdxjs' | ||
* @import {Extension} from 'micromark-util-types' | ||
*/ | ||
|
||
import {Parser} from 'acorn' | ||
import acornJsx from 'acorn-jsx' | ||
import {mdxExpression} from 'micromark-extension-mdx-expression' | ||
import {mdxJsx} from 'micromark-extension-mdx-jsx' | ||
import {mdxMd} from 'micromark-extension-mdx-md' | ||
import {mdxjsEsm} from 'micromark-extension-mdxjs-esm' | ||
import {combineExtensions} from 'micromark-util-combine-extensions' | ||
|
||
/** | ||
* Create an extension for `micromark` to enable MDX syntax. | ||
* | ||
* @param {Options | null | undefined} [options] | ||
* Configuration (optional). | ||
* @returns {Extension} | ||
* Extension for `micromark` that can be passed in `extensions` to enable MDX | ||
* syntax. | ||
*/ | ||
export function mdxjs(options) { | ||
const settings = Object.assign( | ||
{ | ||
acorn: Parser.extend(acornJsx()), | ||
acornOptions: {ecmaVersion: 2024, sourceType: 'module'}, | ||
addResult: true | ||
}, | ||
options | ||
) | ||
|
||
return combineExtensions([ | ||
mdxjsEsm(settings), | ||
mdxExpression(settings), | ||
mdxJsx(settings), | ||
mdxMd() | ||
]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters