File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -451,7 +451,9 @@ export function mdxJsxFromMarkdown() {
451
451
* @type {OnEnterError }
452
452
*/
453
453
function onErrorRightIsTag ( closing , open ) {
454
- const tag = this . data . mdxJsxTag
454
+ const stack = this . data . mdxJsxTagStack
455
+ assert ( stack , 'expected `mdxJsxTagStack`' )
456
+ const tag = stack [ stack . length - 1 ]
455
457
assert ( tag , 'expected `mdxJsxTag`' )
456
458
const place = closing ? ' before the end of `' + closing . type + '`' : ''
457
459
const position = closing
Original file line number Diff line number Diff line change @@ -246,6 +246,18 @@ test('mdxJsxFromMarkdown', async function (t) {
246
246
}
247
247
)
248
248
249
+ await t . test (
250
+ 'should crash on unclosed jsx after closed jsx' ,
251
+ async function ( ) {
252
+ assert . throws ( function ( ) {
253
+ fromMarkdown ( '<a><b></b>' , {
254
+ extensions : [ mdxJsx ( ) ] ,
255
+ mdastExtensions : [ mdxJsxFromMarkdown ( ) ]
256
+ } )
257
+ } , / E x p e c t e d a c l o s i n g t a g f o r ` < a > ` \( 1 : 1 - 1 : 4 \) / )
258
+ }
259
+ )
260
+
249
261
await t . test (
250
262
'should support an attribute expression in text jsx (agnostic)' ,
251
263
async function ( ) {
You can’t perform that action at this time.
0 commit comments