Skip to content

Commit

Permalink
Update mdast-util-mdx-jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jan 31, 2022
1 parent d28aad1 commit c1bcc32
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
24 changes: 17 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
* @typedef {import('mdast-util-mdx-expression').MDXFlowExpression} MDXFlowExpression
* @typedef {import('mdast-util-mdx-expression').MDXTextExpression} MDXTextExpression
* @typedef {import('mdast-util-mdx-jsx').MDXJsxAttributeValueExpression} MDXJsxAttributeValueExpression
* @typedef {import('mdast-util-mdx-jsx').MDXJsxAttribute} MDXJsxAttribute
* @typedef {import('mdast-util-mdx-jsx').MDXJsxExpressionAttribute} MDXJsxExpressionAttribute
* @typedef {import('mdast-util-mdx-jsx').MDXJsxFlowElement} MDXJsxFlowElement
* @typedef {import('mdast-util-mdx-jsx').MDXJsxTextElement} MDXJsxTextElement
* @typedef {import('mdast-util-mdxjs-esm').MDXJSEsm} MDXJSEsm
* @typedef {import('mdast-util-mdx-jsx').MdxJsxAttributeValueExpression} MdxJsxAttributeValueExpression
* @typedef {import('mdast-util-mdx-jsx').MdxJsxAttribute} MdxJsxAttribute
* @typedef {import('mdast-util-mdx-jsx').MdxJsxExpressionAttribute} MdxJsxExpressionAttribute
* @typedef {import('mdast-util-mdx-jsx').MdxJsxFlowElement} MdxJsxFlowElement
* @typedef {import('mdast-util-mdx-jsx').MdxJsxTextElement} MdxJsxTextElement
*/

/**
* Deprecated: remove next major:
*
* @typedef {MdxJsxAttributeValueExpression} MDXJsxAttributeValueExpression
* @typedef {MdxJsxAttribute} MDXJsxAttribute
* @typedef {MdxJsxExpressionAttribute} MDXJsxExpressionAttribute
* @typedef {MdxJsxFlowElement} MDXJsxFlowElement
* @typedef {MdxJsxTextElement} MDXJsxTextElement
*/

import {
Expand All @@ -23,15 +33,15 @@ import {mdxjsEsmFromMarkdown, mdxjsEsmToMarkdown} from 'mdast-util-mdxjs-esm'
* @return {Array<FromMarkdownExtension>}
*/
export function mdxFromMarkdown() {
return [mdxExpressionFromMarkdown, mdxJsxFromMarkdown, mdxjsEsmFromMarkdown]
return [mdxExpressionFromMarkdown, mdxJsxFromMarkdown(), mdxjsEsmFromMarkdown]
}

/** @return {ToMarkdownExtension} */
export function mdxToMarkdown() {
return {
extensions: [
mdxExpressionToMarkdown,
mdxJsxToMarkdown,
mdxJsxToMarkdown(),
mdxjsEsmToMarkdown
]
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
],
"dependencies": {
"mdast-util-mdx-expression": "^1.0.0",
"mdast-util-mdx-jsx": "^1.0.0",
"mdast-util-mdx-jsx": "^2.0.0",
"mdast-util-mdxjs-esm": "^1.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ test('mdast -> markdown', (t) => {
{type: 'mdxJsxFlowElement', name: 'x', attributes: [], children: []},
{extensions: [mdxToMarkdown()]}
),
'<x/>\n',
'<x />\n',
'should support jsx'
)

Expand Down

0 comments on commit c1bcc32

Please sign in to comment.