Skip to content

Commit 4a24c86

Browse files
committed
add fontification to JSX text using font-lock-string-face
1 parent 4db1fc0 commit 4a24c86

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rjsx-mode.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ the `:around' combinator. JS2-PARSER is the original XML parser."
7171
"`rjsx-mode' face used to highlight JSX attribute names."
7272
:group 'rjsx-mode)
7373

74+
(defface rjsx-text
75+
'((t . (:inherit font-lock-string-face)))
76+
"`rjsx-mode' face used to highlight JSX text."
77+
:group 'rjsx-mode)
78+
7479

7580
;;;; Parser constants struct definitions
7681

@@ -692,6 +697,7 @@ and {}-bracketed expressions. Return the parsed child."
692697

693698
((= tt rjsx-JSX-TEXT)
694699
(rjsx-maybe-message "text node: '%s'" (js2-current-token-string))
700+
(js2-set-face (js2-current-token-beg) (js2-current-token-end) 'rjsx-text 'record)
695701
(js2-record-text-property (js2-current-token-beg) (js2-current-token-end)
696702
'syntax-table (standard-syntax-table))
697703
(make-rjsx-text :value (js2-current-token-string)))

0 commit comments

Comments
 (0)