-
-
Notifications
You must be signed in to change notification settings - Fork 260
/
web-mode.el
15108 lines (13883 loc) · 573 KB
/
web-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; web-mode.el --- major mode for editing web templates -*- coding: utf-8; lexical-binding: t; -*-
;; Copyright 2011-2024 François-Xavier Bois
;; Version: 17.3.20
;; Author: François-Xavier Bois
;; Maintainer: François-Xavier Bois <[email protected]>
;; Package-Requires: ((emacs "23.1"))
;; URL: https://web-mode.org
;; Repository: http://github.com/fxbois/web-mode
;; Created: July 2011
;; Keywords: languages
;; License: GNU General Public License >= 3
;; Distribution: This file is not part of Emacs
;;; Commentary:
;;==============================================================================
;; WEB-MODE is sponsored by ** Kernix ** Best Digital Agency & Data Lab (Paris)
;;==============================================================================
;;; Code:
;;---- CONSTS ------------------------------------------------------------------
(defconst web-mode-version "17.3.20"
"Web Mode version.")
;;---- GROUPS ------------------------------------------------------------------
(defgroup web-mode nil
"Major mode for editing web templates"
:group 'languages
:prefix "web-"
:link '(url-link :tag "Site" "https://web-mode.org")
:link '(url-link :tag "Repository" "https://github.com/fxbois/web-mode"))
(defgroup web-mode-faces nil
"Faces for syntax highlighting."
:group 'web-mode
:group 'faces)
;;---- CUSTOMS -----------------------------------------------------------------
(defcustom web-mode-block-padding 0
"Multi-line block (php, ruby, java, python, asp, etc.) left padding.
-1 to have to code aligned on the column 0."
:type '(choice (integer :tags "Number of spaces")
(const :tags "No indent" nil))
:group 'web-mode)
(defcustom web-mode-part-padding 1
"Part elements (script, style) left padding."
:type '(choice (integer :tags "Number of spaces")
(const :tags "No indent" nil))
:group 'web-mode)
(defcustom web-mode-script-padding web-mode-part-padding
"Script element left padding."
:type '(choice (integer :tags "Number of spaces")
(const :tags "No indent" nil))
:group 'web-mode)
(defcustom web-mode-style-padding web-mode-part-padding
"Style element left padding."
:type '(choice (integer :tags "Number of spaces")
(const :tags "No indent" nil))
:group 'web-mode)
(defcustom web-mode-attr-indent-offset nil
"Html attribute indentation level."
:type '(choice (integer :tags "Number of spaces")
(const :tags "Default" nil))
:group 'web-mode)
;;;###autoload
(put 'web-mode-attr-indent-offset
'safe-local-variable #'(lambda (v) (or (integerp v) (booleanp v))))
(defcustom web-mode-attr-value-indent-offset nil
"Html attribute value indentation level."
:type '(choice (integer :tags "Number of spaces")
(const :tags "Default" nil))
:group 'web-mode)
;;;###autoload
(put 'web-mode-attr-value-indent-offset
'safe-local-variable #'(lambda (v) (or (integerp v) (booleanp v))))
(defcustom web-mode-markup-indent-offset
(if (and (boundp 'standard-indent) standard-indent) standard-indent 2)
"Html indentation level."
:type 'integer
:group 'web-mode)
;;;###autoload
(put 'web-mode-markup-indent-offset 'safe-local-variable #'integerp)
(defcustom web-mode-markup-comment-indent-offset
5
"Html comment indentation level."
:type 'integer
:group 'web-mode)
;;;###autoload
(put 'web-mode-markup-comment-indent-offset 'safe-local-variable #'integerp)
(defcustom web-mode-css-indent-offset
(if (and (boundp 'standard-indent) standard-indent) standard-indent 2)
"CSS indentation level."
:type 'integer
:group 'web-mode)
;;;###autoload
(put 'web-mode-css-indent-offset 'safe-local-variable #'integerp)
(defcustom web-mode-code-indent-offset
(if (and (boundp 'standard-indent) standard-indent) standard-indent 2)
"Code (javascript, php, etc.) indentation level."
:type 'integer
:group 'web-mode)
;;;###autoload
(put 'web-mode-code-indent-offset 'safe-local-variable #'integerp)
(defcustom web-mode-sql-indent-offset 4
"Sql (inside strings) indentation level."
:type 'integer
:group 'web-mode)
;;;###autoload
(put 'web-mode-sql-indent-offset 'safe-local-variable #'integerp)
(defcustom web-mode-enable-css-colorization (display-graphic-p)
"In a CSS part, set background according to the color: #xxx, rgb(x,x,x)."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-comment-interpolation nil
"Enable highlight of keywords like FIXME, TODO, etc. in comments."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-comment-annotation nil
"Enable annotation in comments (jsdoc, phpdoc, etc.)."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-auto-indentation (display-graphic-p)
"Auto-indentation."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-auto-closing (display-graphic-p)
"Auto-closing."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-auto-pairing (display-graphic-p)
"Auto-pairing."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-auto-opening (display-graphic-p)
"Html element auto-opening."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-auto-quoting (display-graphic-p)
"Add double quotes after the character = in a tag."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-auto-expanding nil
"e.g. s/ expands to <span>|</span>."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-curly-brace-indentation nil
"Indent lines beginning with {."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-control-block-indentation t
"Control blocks increase indentation."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-current-element-highlight nil
"Enable current element highlight."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-current-column-highlight nil
"Show column for current element."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-whitespace-fontification nil
"Enable whitespaces."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-html-entities-fontification nil
"Enable html entities fontification."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-block-face nil
"Enable block face (useful for setting a background for example).
See web-mode-block-face."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-part-face nil
"Enable part face (useful for setting background of <style> or <script>
elements for example). See web-mode-part-face."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-inlays nil
"Enable inlays (e.g. LaTeX) highlighting."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-sexp-functions t
"Enable specific sexp functions."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-string-interpolation t
"Enable string interpolation fontification (php and erb)."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-literal-interpolation t
"Enable template literal fontification. e.g. css` `."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-sql-detection nil
"Enable fontification and indentation of sql queries in strings."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-heredoc-fontification t
"Enable heredoc fontification. The identifier should contain JS, JAVASCRIPT,
CSS or HTML."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-element-content-fontification nil
"Enable element content fontification. The content of an element can have a
face associated."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-element-tag-fontification nil
"Enable tag name fontification."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-front-matter-block nil
"Enable front matter block (data at the beginning the template
between --- and ---)."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-engine-detection nil
"Detect such directive -*- engine: ENGINE -*- at the top of the file."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-enable-optional-tags nil
"Enable omission of certain closing tags (e.g. a li open tag followed
by a li open tag is valid)."
:type 'boolean
:group 'web-mode)
(defcustom web-mode-comment-style 1
"Comment style : 1 = default, 2 = force server comments outside a block."
:group 'web-mode
:type '(choice (const :tag "Default" 1)
(const :tag "Force engine comments" 2)))
(defcustom web-mode-indent-style 2
"Indentation style."
:group 'web-mode
:type '(choice (const :tag "Default (all lines are indented)" 2)
(const :tag "Text at the beginning of line is not indented" 1)))
(defcustom web-mode-auto-close-style 1
"Auto-close style."
:group 'web-mode
:type '(choice (const :tag "Auto-close on </" 1)
(const :tag "Auto-close on > and </" 2)
(const :tag "Auto-close on < and >/>" 3)))
(defcustom web-mode-auto-quote-style 1
"Auto-quoting style."
:group 'web-mode
:type '(choice (const :tag "Auto-quotes with double quote" 1)
(const :tag "Auto-quotes with single quote" 2)
(const :tag "Auto-quotes with paren (for jsx)" 3)))
(defcustom web-mode-extra-expanders '()
"A list of additional expanders."
:type '(alist :key-type string :value-type string)
:group 'web-mode)
(defcustom web-mode-extra-auto-pairs '()
"A list of additional auto-pairs."
:type '(alist :key-type string :value-type string)
:group 'web-mode)
(defcustom web-mode-extra-snippets '()
"A list of additional snippets."
:type '(alist :key-type string :value-type string)
:group 'web-mode)
(defcustom web-mode-extra-builtins '()
"A list of additional builtins."
:type '(alist :key-type string :value-type string)
:group 'web-mode)
(defcustom web-mode-extra-constants '()
"A list of additional constants."
:type '(alist :key-type string :value-type string)
:group 'web-mode)
(defcustom web-mode-extra-keywords '()
"A list of additional keywords."
:type '(alist :key-type string :value-type string)
:group 'web-mode)
(defcustom web-mode-extra-types '()
"A list of additional types."
:type '(alist :key-type string :value-type string)
:group 'web-mode)
(defcustom web-mode-extra-control-blocks '()
"A list of additional control blocks."
:type '(alist :key-type string :value-type (repeat string))
:group 'web-mode)
(defcustom web-mode-tests-directory (concat default-directory "tests/")
"Directory containing all the unit tests."
:type 'directory
:group 'web-mode)
(defcustom web-mode-jsx-depth-faces
nil
;;'(web-mode-jsx-depth-1-face web-mode-jsx-depth-2-face web-mode-jsx-depth-3-face web-mode-jsx-depth-4-face web-mode-jsx-depth-5-face)
"Each jsx depth has is own face."
:type '(repeat face)
:group 'web-mode)
(defcustom web-mode-commands-like-expand-region
'(web-mode-mark-and-expand er/expand-region mc/mark-next-like-this mc/mark-previous-like-this)
"Add commmand here if you have some wrapper function for er/expand-region"
:type '(repeat function)
:group 'web-mode)
(defcustom web-mode-comment-formats
'(("java" . "/*")
("javascript" . "/*")
("typescript" . "//")
("php" . "/*")
("css" . "/*"))
"Default comment format for a language"
:type '(alist :key-type string :value-type string)
:group 'web-mode)
(defcustom web-mode-script-template-types
'("text/x-handlebars"
"text/x-jquery-tmpl"
"text/x-jsrender"
"text/html"
"text/ng-template"
"text/x-template"
"text/mustache"
"text/x-dust-template")
"<script> block types that are interpreted as HTML."
:type '(repeat string)
:group 'web-mode)
;; https://developer.mozilla.org/en-US/docs/Web/HTML/Element
(defcustom web-mode-tag-list
'("a" "abbr" "address" "area" "article" "aside" "audio" "b"
"base" "bdi" "bdo" "blockquote" "body" "br" "button" "canvas"
"caption" "cite" "code" "col" "colgroup" "data" "datalist"
"dd" "del" "details" "dfn" "dialog" "div" "dl" "dt" "em"
"embed" "fieldset" "figcaption" "figure" "footer" "form" "h1"
"h2" "h3" "h4" "h5" "h6" "head" "header" "hgroup" "hr" "html"
"i" "iframe" "img" "input" "ins" "kbd" "label" "legend" "li"
"link" "main" "map" "mark" "math" "menu" "meta" "meter" "nav"
"noscript" "object" "ol" "optgroup" "option" "output" "p"
"picture" "pre" "progress" "q" "rp" "rt" "ruby" "s" "samp"
"script" "search" "section" "select" "slot" "small" "source"
"span" "strong" "style" "sub" "summary" "sup" "svg" "table"
"tbody" "td" "template" "textarea" "tfoot" "th" "thead" "time"
"title" "tr" "track" "u" "ul" "var" "video" "wbr")
"HTML tags used for completion."
:type '(repeat string)
:group 'web-mode)
;; https://www.w3schools.com/tags/ref_attributes.asp
;; Attributes marked as deprecated in HTML 5 are not added.
(defcustom web-mode-attribute-list
'("accept" "accesskey" "action" "alt" "async" "autocomplete" "autofocus"
"autoplay" "charset" "checked" "cite" "class" "cols" "colspan" "content"
"contenteditable" "controls" "coords" "data" "datetime" "default" "defer"
"dir" "dirname" "disabled" "download" "draggable" "enctype" "for" "form"
"formaction" "headers" "height" "hidden" "high" "href" "hreflang" "http"
"id" "ismap" "kind" "label" "lang" "list" "loop" "low" "max" "maxlength"
"media" "method" "min" "multiple" "muted" "name" "novalidate" "onabort"
"onafterprint" "onbeforeprint" "onbeforeunload" "onblur" "oncanplay"
"oncanplaythrough" "onchange" "onclick" "oncontextmenu" "oncopy"
"oncuechange" "oncut" "ondblclick" "ondrag" "ondragend" "ondragenter"
"ondragleave" "ondragover" "ondragstart" "ondrop" "ondurationchange"
"onemptied" "onended" "onerror" "onfocus" "onhashchange" "oninput"
"oninvalid" "onkeydown" "onkeypress" "onkeyup" "onload" "onloadeddata"
"onloadedmetadata" "onloadstart" "onmousedown" "onmousemove" "onmouseout"
"onmouseover" "onmouseup" "onmousewheel" "onoffline" "ononline"
"onpagehide" "onpageshow" "onpaste" "onpause" "onplay" "onplaying"
"onpopstate" "onprogress" "onratechange" "onreset" "onresize" "onscroll"
"onsearch" "onseeked" "onseeking" "onselect" "onstalled" "onstorage"
"onsubmit" "onsuspend" "ontimeupdate" "ontoggle" "onunload"
"onvolumechange" "onwaiting" "onwheel" "open" "optimum" "pattern"
"placeholder" "poster" "preload" "readonly" "rel" "required" "reversed"
"rows" "rowspan" "sandbox" "scope" "selected" "shape" "size" "sizes"
"span" "spellcheck" "src" "srcdoc" "srclang" "srcset" "start" "step"
"style" "tabindex" "target" "title" "translate" "type" "usemap" "value"
"width" "wrap")
"HTML attributes used for completion."
:type '(repeat string)
:group 'web-mode)
(defcustom web-mode-engines-alist nil
"A list of filename patterns and corresponding `web-mode' engine.
For example,
\(setq web-mode-engines-alist
\\='((\"php\" . \"\\\\.phtml\\\\\\='\")
(\"blade\" . \"\\\\.blade\\\\.\")))"
:type '(alist :key-type string :value-type string)
:group 'web-mode)
;;---- FACES -------------------------------------------------------------------
(defface web-mode-error-face
'((t :background "red"))
"Face for warning."
:group 'web-mode-faces)
(defface web-mode-warning-face
'((t :inherit font-lock-warning-face))
"Face for warning."
:group 'web-mode-faces)
(defface web-mode-preprocessor-face
'((t :inherit font-lock-preprocessor-face))
"Face for preprocessor commands."
:group 'web-mode-faces)
(defface web-mode-preprocessor-face
'((t :inherit font-lock-preprocessor-face))
"Face for preprocessor."
:group 'web-mode-faces)
(defface web-mode-block-delimiter-face
'((t :inherit font-lock-preprocessor-face))
"Face for block delimiters."
:group 'web-mode-faces)
(defface web-mode-block-control-face
'((t :inherit font-lock-preprocessor-face))
"Face for preprocessor."
:group 'web-mode-faces)
(defface web-mode-builtin-face
'((t :inherit font-lock-builtin-face))
"Face for builtins."
:group 'web-mode-faces)
(defface web-mode-symbol-face
'((t :foreground "goldenrod2"))
"Face for symbols."
:group 'web-mode-faces)
(defface web-mode-doctype-face
'((t :foreground "Grey"))
"Face for html doctype."
:group 'web-mode-faces)
(defface web-mode-html-tag-face
'((((class color) (min-colors 88) (background dark)) :foreground "Snow4")
(((class color) (min-colors 88) (background light)) :foreground "Snow4")
(((class color) (min-colors 16) (background dark)) :foreground "Snow4")
(((class color) (min-colors 16) (background light)) :foreground "Grey15")
(((class color) (min-colors 8)) :foreground "Snow4")
(((type tty) (class mono)) :inverse-video t)
(t :foreground "Snow4"))
"Face for html tags."
:group 'web-mode-faces)
(defface web-mode-html-tag-custom-face
'((t :inherit web-mode-html-tag-face))
"Face for html custom tags (e.g. <polymer-element>)."
:group 'web-mode-faces)
(defface web-mode-html-tag-unclosed-face
'((t :inherit web-mode-html-tag-face :underline t))
"Face for unclosed tags."
:group 'web-mode-faces)
(defface web-mode-html-tag-namespaced-face
'((t :inherit web-mode-block-control-face))
"Face for html namespaced tags (e.g. <c:forEach>)."
:group 'web-mode-faces)
(defface web-mode-html-tag-bracket-face
'((((class color) (min-colors 88) (background dark)) :foreground "Snow3")
(((class color) (min-colors 88) (background light)) :foreground "Grey14")
(((class color) (min-colors 16) (background dark)) :foreground "Snow3")
(((class color) (min-colors 16) (background light)) :foreground "Grey14")
(((class color) (min-colors 8)) :foreground "Snow3")
(((type tty) (class mono)) :inverse-video t)
(t :foreground "Snow3"))
"Face for html tags angle brackets (<, > and />)."
:group 'web-mode-faces)
(defface web-mode-html-attr-name-face
'((((class color) (min-colors 88) (background dark)) :foreground "Snow3")
(((class color) (min-colors 88) (background light)) :foreground "Snow4")
(((class color) (min-colors 16) (background dark)) :foreground "Snow3")
(((class color) (min-colors 16) (background light)) :foreground "Grey13")
(((class color) (min-colors 8)) :foreground "Snow3")
(((type tty) (class mono)) :inverse-video t)
(t :foreground "Snow4"))
"Face for html attribute names."
:group 'web-mode-faces)
(defface web-mode-html-attr-custom-face
'((t :inherit web-mode-html-attr-name-face))
"Face for custom attribute names (e.g. data-*)."
:group 'web-mode-faces)
(defface web-mode-html-attr-engine-face
'((t :inherit web-mode-block-delimiter-face))
"Face for custom engine attribute names (e.g. ng-*)."
:group 'web-mode-faces)
(defface web-mode-html-attr-equal-face
'((t :inherit web-mode-html-attr-name-face))
"Face for the = character between name and value."
:group 'web-mode-faces)
(defface web-mode-html-attr-value-face
'((t :inherit font-lock-string-face))
"Face for html attribute values."
:group 'web-mode-faces)
(defface web-mode-block-attr-name-face
'((t :foreground "#8fbc8f"))
"Face for block attribute names."
:group 'web-mode-faces)
(defface web-mode-block-attr-value-face
'((t :foreground "#5f9ea0"))
"Face for block attribute values."
:group 'web-mode-faces)
(defface web-mode-variable-name-face
'((t :inherit font-lock-variable-name-face))
"Face for variable names."
:group 'web-mode-faces)
(defface web-mode-css-selector-face
'((t :inherit font-lock-keyword-face))
"Face for CSS rules."
:group 'web-mode-faces)
(defface web-mode-css-selector-class-face
'((t :inherit font-lock-keyword-face))
"Face for CSS class rules."
:group 'web-mode-faces)
(defface web-mode-css-selector-tag-face
'((t :inherit font-lock-keyword-face))
"Face for CSS tag rules."
:group 'web-mode-faces)
(defface web-mode-css-pseudo-class-face
'((t :inherit font-lock-builtin-face))
"Face for CSS pseudo-classes."
:group 'web-mode-faces)
(defface web-mode-css-at-rule-face
'((t :inherit font-lock-constant-face))
"Face for CSS at-rules."
:group 'web-mode-faces)
(defface web-mode-css-property-name-face
'((t :inherit font-lock-variable-name-face))
"Face for CSS props."
:group 'web-mode-faces)
(defface web-mode-css-color-face
'((t :inherit font-lock-builtin-face))
"Face for CSS colors (#xxx)."
:group 'web-mode-faces)
(defface web-mode-css-priority-face
'((t :inherit font-lock-builtin-face))
"Face for CSS priority (!important)."
:group 'web-mode-faces)
(defface web-mode-css-function-face
'((t :inherit font-lock-builtin-face))
"Face for CSS functions."
:group 'web-mode-faces)
(defface web-mode-css-variable-face
'((t :inherit web-mode-variable-name-face :slant italic))
"Face for CSS vars."
:group 'web-mode-faces)
(defface web-mode-function-name-face
'((t :inherit font-lock-function-name-face))
"Face for function names."
:group 'web-mode-faces)
(defface web-mode-filter-face
'((t :inherit font-lock-function-name-face))
"Face for function names."
:group 'web-mode-faces)
(defface web-mode-function-call-face
'((t :inherit font-lock-function-name-face))
"Face for function calls."
:group 'web-mode-faces)
(defface web-mode-string-face
'((t :inherit font-lock-string-face))
"Face for strings."
:group 'web-mode-faces)
(defface web-mode-block-string-face
'((t :inherit web-mode-string-face))
"Face for block strings."
:group 'web-mode-faces)
(defface web-mode-part-string-face
'((t :inherit web-mode-string-face))
"Face for part strings."
:group 'web-mode-faces)
(defface web-mode-javascript-string-face
'((t :inherit web-mode-string-face))
"Face for javascript strings."
:group 'web-mode-faces)
(defface web-mode-interpolate-color1-face
'((t :inherit web-mode-string-face))
"Face for element interpolation strings."
:group 'web-mode-faces)
(defface web-mode-interpolate-color2-face
'((t :inherit web-mode-string-face))
"Face for element interpolation strings."
:group 'web-mode-faces)
(defface web-mode-interpolate-color3-face
'((t :inherit web-mode-string-face))
"Face for element interpolation strings."
:group 'web-mode-faces)
(defface web-mode-interpolate-color4-face
'((t :inherit web-mode-string-face))
"Face for element interpolation strings."
:group 'web-mode-faces)
(defface web-mode-css-string-face
'((t :inherit web-mode-string-face))
"Face for css strings."
:group 'web-mode-faces)
(defface web-mode-json-key-face
'((t :foreground "plum"))
"Face for json key strings."
:group 'web-mode-faces)
(defface web-mode-json-context-face
'((t :foreground "orchid3"))
"Face for json context strings."
:group 'web-mode-faces)
(defface web-mode-json-string-face
'((t :inherit web-mode-string-face))
"Face for json strings."
:group 'web-mode-faces)
(defface web-mode-comment-face
'((t :inherit font-lock-comment-face))
"Face for comments."
:group 'web-mode-faces)
(defface web-mode-block-comment-face
'((t :inherit web-mode-comment-face))
"Face for server comments."
:group 'web-mode-faces)
(defface web-mode-part-comment-face
'((t :inherit web-mode-comment-face))
"Face for part comments."
:group 'web-mode-faces)
(defface web-mode-json-comment-face
'((t :inherit web-mode-comment-face))
"Face for json comments."
:group 'web-mode-faces)
(defface web-mode-javascript-comment-face
'((t :inherit web-mode-comment-face))
"Face for javascript comments."
:group 'web-mode-faces)
(defface web-mode-css-comment-face
'((t :inherit web-mode-comment-face))
"Face for css comments."
:group 'web-mode-faces)
(defface web-mode-annotation-face
'((t :inherit web-mode-comment-face))
"Face for code annotations."
:group 'web-mode-faces)
(defface web-mode-annotation-tag-face
'((t :inherit web-mode-annotation-face :underline t))
"Face for @tags in code annotations."
:group 'web-mode-faces)
(defface web-mode-annotation-type-face
'((t :inherit web-mode-annotation-face :weight bold))
"Face for types in code annotations."
:group 'web-mode-faces)
(defface web-mode-annotation-value-face
'((t :inherit web-mode-annotation-face :slant italic))
"Face for values in code annotations."
:group 'web-mode-faces)
(defface web-mode-annotation-html-face
'((t :inherit web-mode-annotation-face :slant italic))
"Face for HTML tags in code annotations."
:group 'web-mode-faces)
(defface web-mode-constant-face
'((t :inherit font-lock-constant-face))
"Face for language constants."
:group 'web-mode-faces)
(defface web-mode-type-face
'((t :inherit font-lock-type-face))
"Face for language types."
:group 'web-mode-faces)
(defface web-mode-keyword-face
'((t :inherit font-lock-keyword-face))
"Face for language keywords."
:group 'web-mode-faces)
(defface web-mode-param-name-face
'((t :foreground "Snow3"))
"Face for server attribute names."
:group 'web-mode-faces)
(defface web-mode-whitespace-face
'((t :background "DarkOrchid4"))
"Face for whitespaces."
:group 'web-mode-faces)
(defface web-mode-inlay-face
'((((class color) (min-colors 88) (background dark)) :background "Black")
(((class color) (min-colors 88) (background light)) :background "LightYellow1")
(((class color) (min-colors 16) (background dark)) :background "Brey18")
(((class color) (min-colors 16) (background light)) :background "LightYellow1")
(((class color) (min-colors 8)) :background "Black")
(((type tty) (class mono)) :inverse-video t)
(t :background "Grey"))
"Face for inlays. Must be used in conjunction with web-mode-enable-inlays."
:group 'web-mode-faces)
(defface web-mode-block-face
'((((class color) (min-colors 88) (background dark)) :background "Black")
(((class color) (min-colors 88) (background light)) :background "LightYellow1")
(((class color) (min-colors 16) (background dark)) :background "Grey18")
(((class color) (min-colors 16) (background light)) :background "LightYellow1")
(((class color) (min-colors 8)) :background "Black")
(((type tty) (class mono)) :inverse-video t)
(t :background "Grey"))
"Face for blocks (useful for setting a background for example).
Must be used in conjunction with web-mode-enable-block-face."
:group 'web-mode-faces)
(defface web-mode-part-face
'((t :inherit web-mode-block-face))
"Face for parts."
:group 'web-mode-faces)
(defface web-mode-script-face
'((t :inherit web-mode-part-face))
"Face for javascript inside a script element."
:group 'web-mode-faces)
(defface web-mode-style-face
'((t :inherit web-mode-part-face))
"Face for css inside a style element."
:group 'web-mode-faces)
(defface web-mode-folded-face
'((t :underline t))
"Overlay face for folded."
:group 'web-mode-faces)
(defface web-mode-bold-face
'((t :weight bold))
"bold face."
:group 'web-mode-faces)
(defface web-mode-italic-face
'((t :slant italic))
"bold face."
:group 'web-mode-faces)
(defface web-mode-underline-face
'((t :underline t))
"bold face."
:group 'web-mode-faces)
(defface web-mode-current-element-highlight-face
'((t :background "#000000" :foreground "#ffffff"))
"Overlay face for element highlight."
:group 'web-mode-faces)
(defface web-mode-current-column-highlight-face
'((t :background "#3e3c36"))
"Overlay face for current column."
:group 'web-mode-faces)
(defface web-mode-comment-keyword-face
'((t :weight bold :box t))
"Comment keywords."
:group 'web-mode-faces)
(defface web-mode-sql-keyword-face
'((t :weight bold :slant italic))
"Sql keywords."
:group 'web-mode-faces)
(defface web-mode-html-entity-face
'((t :slant italic))
"Face html entities (e.g. –, é)."
:group 'web-mode-faces)
;; https://material.io/tools/color/#!/?view.left=0&view.right=0
(defface web-mode-jsx-depth-1-face
'((t :background "#000053"))
"jsx depth 1"
:group 'web-mode-faces)
(defface web-mode-jsx-depth-2-face
'((t :background "#001970"))
"jsx"
:group 'web-mode-faces)
(defface web-mode-jsx-depth-3-face
'((t :background "#002984"))
"jsx"
:group 'web-mode-faces)
(defface web-mode-jsx-depth-4-face
'((t :background "#49599a"))
"jsx"
:group 'web-mode-faces)
(defface web-mode-jsx-depth-5-face
'((t :background "#9499b7"))
"jsx"
:group 'web-mode-faces)
;;---- VARS --------------------------------------------------------------------
(defvar font-lock-beg)
(defvar font-lock-end)
(defvar web-mode-auto-pairs nil)
(defvar web-mode-block-regexp nil)
(defvar web-mode-change-beg nil)
(defvar web-mode-change-end nil)
(defvar web-mode-chunk-length 64)
(defvar web-mode-column-overlays nil)
(defvar web-mode-comments-invisible nil)
(defvar web-mode-content-type "")
(defvar web-mode-engine nil)
;;(defvar web-mode-engine-attr-regexp nil)
(defvar web-mode-engine-font-lock-keywords nil)
(defvar web-mode-engine-token-regexp nil)
(defvar web-mode-expand-initial-pos nil)
(defvar web-mode-expand-initial-scroll nil)
(defvar web-mode-expand-previous-state "")
;;(defvar web-mode-font-lock-keywords '(web-mode-font-lock-highlight))
(defvar web-mode-skip-fontification nil)
(defvar web-mode-inlay-regexp nil)
(defvar web-mode-is-scratch nil)
(defvar web-mode-jshint-errors 0)
(defvar web-mode-minor-engine nil)
(defvar web-mode-obarray nil)
(defvar web-mode-overlay-tag-start nil)
(defvar web-mode-overlay-tag-end nil)
(defvar web-mode-part-beg nil)
(defvar web-mode-scan-beg nil)
(defvar web-mode-scan-end nil)
(defvar web-mode-snippets nil)
(defvar web-mode-time nil)
(defvar web-mode-offsetless-elements
'())
(defvar web-mode-indentless-elements
'("code" "pre" "textarea"))
(defvar web-mode-indentless-attributes
'("onclick" "onmouseover" "onmouseout" "onsubmit"))
(defvar web-mode-void-elements
'("area" "base" "br" "col" "command" "embed" "hr" "img" "input" "keygen"
"link" "meta" "param" "source" "track" "wbr" "tmpl_var"))
(defvar web-mode-part-content-types
'("css" "javascript" "json" "jsx" "markdown" "pug" "ruby"
"sass" "sql" "stylus" "typescript"))
(defvar web-mode-javascript-languages '("javascript" "jsx" "ejs"))
;; NOTE: without 'syntax-table forward-word fails (#377)
(defvar web-mode-scan-properties
(list 'tag-beg 'tag-end 'tag-name 'tag-type
'tag-attr 'tag-attr-beg 'tag-attr-end
'part-side 'part-token
'jsx-beg 'jsx-end 'jsx-depth
'block-side 'block-token 'block-controls 'block-beg 'block-end
'syntax-table)
"Text properties used for code regions/tokens and html nodes.")
(defvar web-mode-start-tag-regexp "<\\([[:alnum:].:_-]+\\|>\\)"
"Regular expression for HTML/XML start tag.")
(defvar web-mode-tag-regexp "</?\\([[:alnum:].:_-]+\\)"
"Regular expression for HTML/XML tag.")
(defvar web-mode-dom-regexp "<\\(/?>\\|/?[[:alnum:].:_-]+\\|!--\\|!\\[CDATA\\[\\|!doctype\\|!DOCTYPE\\|\?xml\\)")
(defvar web-mode-whitespaces-regexp
"^[ \t]\\{2,\\}$\\| \t\\|\t \\|[ \t]+$\\|^[ \n\t]+\\'\\|^[ \t]?[\n]\\{2,\\}"
"Regular expression for whitespaces.")
(defvar web-mode-imenu-regexp-list
'(("<\\(h[1-9]\\)\\([^>]*\\)>\\([^<]*\\)" 1 3 ">")
("^[ \t]*<\\([@a-z]+\\)[^>]*>? *$" 1 "id=\"\\([a-zA-Z0-9_]+\\)\"" "#" ">"))
"Regexps to match imenu items (see https://web-mode.org/doc/imenu.txt)")
;; https://www.gnu.org/software/emacs/manual/html_node/ccmode/Syntactic-Symbols.html
(defvar web-mode-indentation-params
'(("lineup-args" . t)
("lineup-calls" . t)
("lineup-concats" . t)
("lineup-quotes" . t)
("lineup-ternary" . t)
("case-extra-offset" . t)
))
(defvar web-mode-tag-history nil)
(defvar web-mode-attribute-history nil)
(defvar web-mode-attribute-value-history nil)
(defvar web-mode-engines
'(("angular" . ("angularjs"))
("anki" . ())
("antlers" . ())
("archibus" . ())
("artanis" . ())
("asp" . ())
("aspx" . ())
("astro" . ())
("blade" . ("laravel"))
("cl-emb" . ())
("clip" . ())
("closure" . ("soy"))
("ctemplate" . ("mustache" "handlebars" "hapax" "ngtemplate" "ember"
"kite" "meteor" "blaze" "ractive" "velvet"))
("django" . ("dtl" "twig" "swig" "jinja" "jinja2" "erlydtl" "liquid"
"clabango" "selmer" "nunjucks"))
("dust" . ("dustjs"))
("ejs" . ())
("elixir" . ("phoenix"))