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

Interleaving buggy with JSX, expressions, and braces in expressions #9

Closed
4 tasks done
wooorm opened this issue Feb 9, 2023 · 2 comments
Closed
4 tasks done
Labels
💪 phase/solved Post is done

Comments

@wooorm
Copy link
Member

wooorm commented Feb 9, 2023

Initial checklist

Affected packages and versions

latest

Link to runnable example

mdx playground

Steps to reproduce

<a>{[
  'b',
  {name: 'c'}
]}</a>

Expected behavior

No crash, as changing {name: 'c'} to 'c' works. No reason for that.

Actual behavior

Crash

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Feb 9, 2023
@wooorm
Copy link
Member Author

wooorm commented Oct 19, 2023

Ah, this is complex. Did some digging and what’s going on is that “blocks” are parsed before “inlines”. When parsing blocks, roughly this happens:

<a>{[ <-- this is not a block because there’s a `{` after it.
  'b',  <-- just random text
  {name: 'c'} <-- found a block! let’s parse the expression; ok `name` is an identifier; wait there’s more? That isn’t a valid expression: throw!
]}</a>

wooorm added a commit to micromark/micromark-extension-mdx-expression that referenced this issue Oct 19, 2023
@wooorm wooorm closed this as completed in f68f69d Oct 19, 2023
@github-actions

This comment has been minimized.

@wooorm wooorm added the 💪 phase/solved Post is done label Oct 19, 2023
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

No branches or pull requests

1 participant