Skip to content

Commit

Permalink
feat!: go back on #221 and include spaces (without newlines) in JSX…
Browse files Browse the repository at this point in the history
… text
  • Loading branch information
amaanq committed Aug 17, 2024
1 parent d8f277f commit 959ef17
Show file tree
Hide file tree
Showing 5 changed files with 41,192 additions and 41,397 deletions.
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

0 comments on commit 959ef17

Please sign in to comment.