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

Using transformerNotationHighlight in JSX code #770

Open
3 of 5 tasks
Yonom opened this issue Sep 5, 2024 · 1 comment
Open
3 of 5 tasks

Using transformerNotationHighlight in JSX code #770

Yonom opened this issue Sep 5, 2024 · 1 comment

Comments

@Yonom
Copy link

Yonom commented Sep 5, 2024

Validations

Describe the bug

```ts
const Test: React.FC = () => {
  return (
    <div>
      <div /> {/* [!code highlight] */}
    </div>
  );
};
```

gets converted to

const Test: React.FC = () => {
  return (
    <div>
      <div /> {}
    </div>
  );
};

I expected no empty brackets {} to remain. I believe {/* comment */} is the only valid syntax for comments inside JSX.

Reproduction

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests
@Yonom
Copy link
Author

Yonom commented Sep 5, 2024

I believe the regex here would have to be adjusted to also capture the curly brackets {}

new RegExp(`\\s*(?://|/\\*|<!--|#|--|%{1,2}|;{1,2}|"|')\\s+\\[!code (${Object.keys(classMap).map(escapeRegExp).join('|')})(:\\d+)?\\]\\s*(?:\\*/|-->)?\\s*$`),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant