-
Update docs says this about the differences with the previous version:
And running playground on:
Also shows it:
In the code above there are now way to replace second But there a lot of cases then default markdown syntax is not enough and you are forced to use html tags instead, on of the main examples are tables and multiline content. You can render table in markdown with Same with images. There are no way to add width and height to the image in markdown, but it can be done in html. In the last version I was replacing Is there a way to enable back old non-sandbox behavior or apply custom components to html tags as well? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Many people found the old behavior unexpected: #821, hence this change. import {compile} from '@mdx-js/mdx'
main()
async function main() {
const doc = await compile('<Image />')
console.log(String(doc));
} You can now pass or provide or import /*@jsxRuntime automatic @jsxImportSource react*/
import {Fragment as _Fragment, jsx as _jsx} from "react/jsx-runtime";
function MDXContent(props = {}) {
const _components = Object.assign({}, props.components), {Image, wrapper: MDXLayout} = _components;
const _content = _jsx(_Fragment, {
children: _jsx(Image, {})
});
return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {
children: _content
})) : _content;
}
export default MDXContent; |
Beta Was this translation helpful? Give feedback.
-
Answering my own question here. This feature was removed from There are no official option in compiler to change this behavior, but it can be done using the plugins. To revert this change you need to write a plugin that will remove If you don't want to write plugin yourself, you can use this one: https://github.com/iAdramelk/remark-mdx-disable-explicit-jsx |
Beta Was this translation helpful? Give feedback.
Many people found the old behavior unexpected: #821, hence this change.
Because there is an alternative: use
Image
:You can now pass or provide or import
Image
: