-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
good first issue 👋This may be a great place to get started!This may be a great place to get started!🐛 type/bugThis is a problemThis is a problem🦋 type/enhancementThis is great to haveThis is great to have
Description
Comments coming from markdown, going to MDXHAST, will be represented like this: {type: 'comment', value: '<!--something-->'}, whereas comments in hast itself don’t have the prefix/suffix.
This is not a bug, in that it doesn’t matter in this project, but it’s a bug compared to mdast.
mdx/packages/mdx/md-ast-to-mdx-ast.js
Lines 5 to 6 in be4877e
| if (node.value.startsWith('<!--') && node.value.endsWith('-->')) { | |
| node.type = 'comment' |
The code above, in md-ast-to-mdx-ast.js, should drop the prefix and suffix
mdx/packages/mdx/mdx-hast-to-jsx.js
Lines 152 to 153 in be4877e
| if (node.type === 'comment') { | |
| return node.value.replace('<!--', '{/*').replace('-->', '*/}') |
The code above, in mdx-hast-to-jsx.js, should not replace, but prepend and append the JSX prefix and suffix
silvenon
Metadata
Metadata
Assignees
Labels
good first issue 👋This may be a great place to get started!This may be a great place to get started!🐛 type/bugThis is a problemThis is a problem🦋 type/enhancementThis is great to haveThis is great to have