micromark / micromark-extension-mdx-expression

micromark extension to support MDX or MDX JS expressions
https://unifiedjs.com
MIT License
11 stars 2 forks source link

JSX Expression triggers internal error instead of parser error #1

Closed ChristianMurphy closed 2 years ago

ChristianMurphy commented 2 years ago

Initial checklist

Affected packages and versions

micromark-factory-mdx-expression 1.0.4

Link to runnable example

https://stackblitz.com/edit/node-rmrcgb?file=index.js

Steps to reproduce

const content = `<jsx{a=a}={}`;

import { micromark } from 'micromark';
import { mdxjs } from 'micromark-extension-mdxjs';

const output = micromark(content, {
  extensions: [mdxjs()],
});

console.log(output);

Expected behavior

error message explaining JSX is invalid

Actual behavior

TypeError: Cannot read properties of undefined (reading '1')
    at atClosingBrace (/node_modules/micromark-factory-mdx-expression/index.js:138:37)
    at atBreak (/node_modules/micromark-factory-mdx-expression/index.js:64:14)
    at inside (/node_modules/micromark-factory-mdx-expression/index.js:90:14)
    at go (/node_modules/micromark/lib/create-tokenizer.js:216:13)
    at main (/node_modules/micromark/lib/create-tokenizer.js:199:11)
    at Object.write (/node_modules/micromark/lib/create-tokenizer.js:132:5)
    at writeToChild (/node_modules/micromark/lib/initialize/document.js:247:15)
    at flowContinue (/node_modules/micromark/lib/initialize/document.js:216:7)
    at go (/node_modules/micromark/lib/create-tokenizer.js:216:13)
    at main (/node_modules/micromark/lib/create-tokenizer.js:202:9)

Runtime

Node v16

Package manager

npm v7

OS

Linux

Build and bundle tools

No response

github-actions[bot] commented 2 years ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.