Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for non-JSX HTML (or at least good error message about issues with it) #1206

Open
rufuspollock opened this issue Jun 27, 2024 · 1 comment

Comments

@rufuspollock
Copy link
Member

Should we allow support for traditional non-JSX html in markdown files?

Atm you can only use html if it is valid "jsx" so attributes must be camel-cased, class must be className etc. This is because we process all markdown files as MDX rather than markdown.

At very least i think we should have a good error message for this as i've seen this come up many times.

html style comments don't work

<!-- ... -->

Mention this because out of the box MDX (v2) does not support html comments and will throw and error like:

_mdx_bundler_entry_point-77f4c2f4-7bc6-4382-8a6e-cd2d3d4a7924.mdx:122:1: ERROR: [plugin: @mdx-js/esbuild] Unexpected character `!` (U+0021) before name, expected a character that can start a name, such as a letter, `, or `_` (note: to create a comment in MDX, use `{/* text */}`)

Instead mdx supports JSX comments e.g. {/* ... */}

See mdx-js/mdx#1042 for discussion and suggestion of using a plugin like https://github.com/leebyron/remark-comment to resolve the problem

@rufuspollock
Copy link
Member Author

Another data point: just fixed an issue in https://datahub.io/core/atp-world-tour-tennis-data which was 500'ing

Change is here datasets/atp-world-tour-tennis-data@4620a2f and basically it was just removing some html - this was based on my wild guess was there was something likely in the html (90% of 500 errors are react barfing on html in some way b/c react is very exacting regarding html)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants