Skip to content

Commit

Permalink
Update mdast-util-mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jan 31, 2022
1 parent a732d5f commit 59d9ae5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/plugin/remark-mdx.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* @typedef {import('mdast').Root} Root
* @typedef {import('micromark-extension-mdxjs').Options} Options
* @typedef {import('micromark-extension-mdxjs').Options} MicromarkOptions
* @typedef {import('mdast-util-mdx').ToMarkdownOptions} ToMarkdownOptions
* @typedef {MicromarkOptions & ToMarkdownOptions} Options
*
* @typedef {import('mdast-util-mdx')} DoNotTouchAsThisImportIncludesMdxInTree
*/
Expand All @@ -17,8 +19,8 @@ export function remarkMdx(options = {}) {
const data = this.data()

add('micromarkExtensions', mdxjs(options))
add('fromMarkdownExtensions', mdxFromMarkdown)
add('toMarkdownExtensions', mdxToMarkdown)
add('fromMarkdownExtensions', mdxFromMarkdown())
add('toMarkdownExtensions', mdxToMarkdown(options))

/**
* @param {string} field
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"got": "^11.0.0",
"hast-util-to-estree": "^2.0.0",
"markdown-extensions": "^1.0.0",
"mdast-util-mdx": "^1.0.0",
"mdast-util-mdx": "^2.0.0",
"micromark-extension-mdxjs": "^1.0.0",
"periscopic": "^3.0.0",
"remark-parse": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,13 @@ export default function Layout({children}) {
remarkPlugins: [
() => (/** @type {Root} */ tree) => {
tree.children.unshift({
// @ts-expect-error MDXHAST.
type: 'mdxjsEsm',
value: '',
data: {
estree: {
type: 'Program',
comments: [],
sourceType: 'module',
body: [
{
type: 'VariableDeclaration',
Expand Down

0 comments on commit 59d9ae5

Please sign in to comment.