mdx-js / mdx

Markdown for the component era

Home Page:https://mdxjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Useless/bad error message when forgetting to close an element

theRealProHacker opened this issue · comments

Initial checklist

Affected packages and versions

latest

Link to runnable example

https://mdxjs.com/playground/

Steps to reproduce

Linked issue in astro: withastro/astro#10318

This code

<A>
<B></B>

results in this error message:

1:1: Expected a closing tag for `</B>` (1:1-1:4)

Expected behavior

I would have expected an error that asks me to close the <A> tag/element.

Actual behavior

The error asks me to close the </B> tag, which is itself a closing tag

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

Welcome @theRealProHacker! 👋
Sorry you ran into some confusion.

The error is not raised in this repo, it comes from https://github.com/syntax-tree/mdast-util-mdx-jsx/blob/bf60d93bdffde6e4d3359324170d438e5ee62a63/lib/index.js#L424-L471
Contributions to improve error reporting are welcome!

Feel free to reach out with questions on how to contribute.

@ChristianMurphy Hi, the issue got fixed in syntax-tree/mdast-util-mdx-jsx#12 and put in a new release (https://github.com/syntax-tree/mdast-util-mdx-jsx/releases/tag/3.1.1). I don't know where exactly, but maybe the dependency should be bumped up in the playground etc.

Thanks @theRealProHacker, it's already fixed in the playground and allowed by released version ranges.