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

feat!: go back on #221 and include spaces (without newlines) in JSX text #335

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = grammar({
// it should NOT parse html comments.
$.escape_sequence,
$.regex_pattern,
$.jsx_text,
],

extras: $ => [
Expand Down Expand Up @@ -610,13 +611,6 @@ module.exports = grammar({
field('close_tag', $.jsx_closing_element),
),

jsx_text: _ => choice(
// if there is a newline, only capture if there's non-whitespace-text
token.immediate(/[^{}<>&]*[^{}<>\s\p{Zs}\uFEFF\u2028\u2029\u2060\u200B&][^{}<>&]*/),
// whitespace between jsx_tags should be captured if there's no newline
token.immediate(/[^{}<>\n&]+/),
),

// An entity can be named, numeric (decimal), or numeric (hexadecimal). The
// longest entity name is 29 characters long, and the HTML spec says that
// no more will ever be added.
Expand Down
23 changes: 4 additions & 19 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading