Skip to content

Comments ( without new line above them result in babel error #243

@DavidWells

Description

@DavidWells

Ref: #184 (comment)

It looks like this is working for most comments but I just ran into an error with comments in MD

The markdown looks like this:

# login

<!-- AUTO-GENERATED-CONTENT:START (TOC) -->
- [login](#login-1)
<!-- AUTO-GENERATED-CONTENT:END -->

It replaces the top <!-- AUTO-GENERATED-CONTENT:START (TOC) --> correctly but passes over the second comment <!-- AUTO-GENERATED-CONTENT:END --> because there is no newline

This results in a babel error:

Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (15:1)

  13 | <MDXTag name="li" components={components} parentName="ul">
  14 | <MDXTag name="p" components={components} parentName="li"><MDXTag name="a" components={components} parentName="p" props={{"href":"#login-1"}}>{`login`}</MDXTag></MDXTag>
> 15 | <!-- AUTO-GENERATED-CONTENT:END -->
     |  ^
  16 | </MDXTag>
  17 | </MDXTag>
  18 | {/* AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) */}

I was able to work around it by adding a newline after the list. This markdown works because there is a newline after the list

# login

<!-- AUTO-GENERATED-CONTENT:START (TOC) -->
- [login](#login-1)

<!-- AUTO-GENERATED-CONTENT:END -->

Is there a way to support this without the newline? Thanks!

Loving MDX btw it's freaking sweet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions