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

Inline code with angle brackets nested in JSX tag causes highlighting to fail #183

Closed
willcrichton opened this issue Oct 24, 2021 · 1 comment · Fixed by #317
Closed
Labels
🙉 open/needs-info This needs some more info 🐛 type/bug This is a problem

Comments

@willcrichton
Copy link

Subject of the issue

If I have a program like this:

<Hey>
`<F<` x  
y
</Hey>

This has weird syntax highlighting:

Screen Shot 2021-10-24 at 12 42 08 PM

This case is minimal. If I remove e.g. the F or an angle bracket <, then the highlighting returns to normal:

Screen Shot 2021-10-24 at 12 42 13 PM

Your environment

  • OS: MacOS
  • Packages: n/a
  • Env: VSCode 1.61.2, VSCode MDX 0.2.3
@willcrichton willcrichton added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Oct 24, 2021
@karlhorky
Copy link

karlhorky commented Jan 5, 2022

Another example of this:

Screen Shot 2022-01-05 at 18 39 48

Code:

<RevealAnswer>

abc `a <firstName>`

</RevealAnswer>

error`Unexpected token, expected "{"`

What's the problem here?

```javascript showLineNumbers
function addAndDivideByFive(numberA, numberB)
  console.log('numberA', numberA) {
  const sum = numberA + numberB;
  const result = sum / 5;
  return result;
}
```

Solution: We broke the function statement because we misplaced the `console.log`. The error message already gave us a hint about that. A `{` is expected right after specifying the parameters because the function 

wooorm added a commit that referenced this issue Mar 21, 2023
This now pulls in a grammar for from:
<https://github.com/wooorm/markdown-tm-language>.

It fixes a bunch of previous errors and adds real support for MDX.
It also supports YAML frontmatter, TOML frontmatter, GFM (autolink
literals, footnotes, strikethrough, tables, tasklists), GitHub (gemoji,
mentions, references).
There’s support for about 20 common embedded grammars in fenced code
blocks.
Embedded code (in fenced code blocks, or in ESM/expressions) is now
marked as being the correct language, which makes comments and such
work.

Closes GH-183.
Closes GH-191.
Closes GH-209.
Closes GH-221.
remcohaszing added a commit that referenced this issue Mar 23, 2023
This now pulls in a grammar for from:
<https://github.com/wooorm/markdown-tm-language>.

It fixes a bunch of previous errors and adds real support for MDX.
It also supports YAML frontmatter, TOML frontmatter, GFM (autolink
literals, footnotes, strikethrough, tables, tasklists), GitHub (gemoji,
mentions, references).
There’s support for about 20 common embedded grammars in fenced code
blocks.
Embedded code (in fenced code blocks, or in ESM/expressions) is now
marked as being the correct language, which makes comments and such
work.

Closes GH-183.
Closes GH-191.
Closes GH-209.
Closes GH-221.

Co-authored-by: Remco Haszing <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙉 open/needs-info This needs some more info 🐛 type/bug This is a problem
Development

Successfully merging a pull request may close this issue.

2 participants