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() {
451451 * @type {OnEnterError }
452452 */
453453 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 ]
455457 assert ( tag , 'expected `mdxJsxTag`' )
456458 const place = closing ? ' before the end of `' + closing . type + '`' : ''
457459 const position = closing
Original file line number Diff line number Diff line change @@ -246,6 +246,18 @@ test('mdxJsxFromMarkdown', async function (t) {
246246 }
247247 )
248248
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+
249261 await t . test (
250262 'should support an attribute expression in text jsx (agnostic)' ,
251263 async function ( ) {
You can’t perform that action at this time.
0 commit comments