File tree 2 files changed +50
-2
lines changed
src/basic-languages/markdown 2 files changed +50
-2
lines changed Original file line number Diff line number Diff line change @@ -43,5 +43,53 @@ testTokenization('markdown', [
43
43
{ startIndex : 11 , type : 'string.link.md' }
44
44
]
45
45
}
46
+ ] ,
47
+
48
+ // simple HTML content
49
+ [
50
+ {
51
+ line : '<div>content</div>' ,
52
+ tokens : [
53
+ { startIndex : 0 , type : 'tag.md' } ,
54
+ { startIndex : 5 , type : '' } ,
55
+ { startIndex : 12 , type : 'tag.md' }
56
+ ]
57
+ }
58
+ ] ,
59
+
60
+ // hyphenated HTML tag
61
+ [
62
+ {
63
+ line : '<custom-component>content</custom-component>' ,
64
+ tokens : [
65
+ { startIndex : 0 , type : 'tag.md' } ,
66
+ { startIndex : 18 , type : '' } ,
67
+ { startIndex : 25 , type : 'tag.md' }
68
+ ]
69
+ }
70
+ ] ,
71
+
72
+ // unclosed HTML tag without hyphens and a trailing character
73
+ [
74
+ {
75
+ line : '<div' ,
76
+ tokens : [ { startIndex : 0 , type : 'tag.md' } ]
77
+ }
78
+ ] ,
79
+
80
+ // unclosed HTML tag with trailing hyphen
81
+ [
82
+ {
83
+ line : '<custom-' ,
84
+ tokens : [ { startIndex : 0 , type : 'tag.md' } ]
85
+ }
86
+ ] ,
87
+
88
+ // unclosed HTML tag with hyphen and a trailing characer
89
+ [
90
+ {
91
+ line : '<custom-component' ,
92
+ tokens : [ { startIndex : 0 , type : 'tag.md' } ]
93
+ }
46
94
]
47
95
] ) ;
Original file line number Diff line number Diff line change @@ -166,15 +166,15 @@ export const language = <languages.IMonarchLanguage>{
166
166
// html tags
167
167
[ / < ( \w + ) \/ > / , 'tag' ] ,
168
168
[
169
- / < ( \w + ) / ,
169
+ / < ( \w + ) ( \- | \w ) * / ,
170
170
{
171
171
cases : {
172
172
'@empty' : { token : 'tag' , next : '@tag.$1' } ,
173
173
'@default' : { token : 'tag' , next : '@tag.$1' }
174
174
}
175
175
}
176
176
] ,
177
- [ / < \/ ( \w + ) \s * > / , { token : 'tag' } ] ,
177
+ [ / < \/ ( \w + ) ( \- | \w ) * \s * > / , { token : 'tag' } ] ,
178
178
179
179
[ / < ! - - / , 'comment' , '@comment' ]
180
180
] ,
You can’t perform that action at this time.
0 commit comments