Skip to content

Comment bug (spec) #312

@wooorm

Description

@wooorm

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.

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions