1
+ // Couple of ARIA attributes allowed in several, but not all, places.
2
+ const aria = [ 'ariaDescribedBy' , 'ariaLabel' , 'ariaLabelledBy' ]
3
+
1
4
/**
2
5
* Default schema.
3
6
*
@@ -15,18 +18,53 @@ export const defaultSchema = {
15
18
tr : [ 'table' ]
16
19
} ,
17
20
attributes : {
18
- a : [ 'href' ] ,
21
+ a : [
22
+ ...aria ,
23
+ // Note: these 3 are used by GFM footnotes, they do work on all links.
24
+ 'dataFootnoteBackref' ,
25
+ 'dataFootnoteRef' ,
26
+ [ 'className' , 'data-footnote-backref' ] ,
27
+ 'href'
28
+ ] ,
19
29
blockquote : [ 'cite' ] ,
30
+ // Note: this class is not normally allowed by GH, when manually writing
31
+ // `code` as HTML in markdown, they adds it some other way.
32
+ // We can’t do that, so we have to allow it.
33
+ code : [ [ 'className' , / ^ l a n g u a g e - ./ ] ] ,
20
34
del : [ 'cite' ] ,
21
35
div : [ 'itemScope' , 'itemType' ] ,
22
- img : [ 'longDesc' , 'src' ] ,
36
+ dl : [ ...aria ] ,
37
+ // Note: these 2 are used by GFM footnotes, they *sometimes* work.
38
+ h2 : [
39
+ [ 'id' , 'footnote-label' ] ,
40
+ [ 'className' , 'sr-only' ]
41
+ ] ,
42
+ img : [ ...aria , 'longDesc' , 'src' ] ,
43
+ // Note: `input` is not normally allowed by GH, when manually writing
44
+ // it in markdown, they add it from tasklists some other way.
45
+ // We can’t do that, so we have to allow it.
23
46
input : [
24
47
[ 'disabled' , true ] ,
25
48
[ 'type' , 'checkbox' ]
26
49
] ,
27
50
ins : [ 'cite' ] ,
51
+ // Note: this class is not normally allowed by GH, when manually writing
52
+ // `li` as HTML in markdown, they adds it some other way.
53
+ // We can’t do that, so we have to allow it.
28
54
li : [ [ 'className' , 'task-list-item' ] ] ,
55
+ // Note: this class is not normally allowed by GH, when manually writing
56
+ // `ol` as HTML in markdown, they adds it some other way.
57
+ // We can’t do that, so we have to allow it.
58
+ ol : [ ...aria , [ 'className' , 'contains-task-list' ] ] ,
29
59
q : [ 'cite' ] ,
60
+ section : [ 'dataFootnotes' , [ 'className' , 'footnotes' ] ] ,
61
+ source : [ 'srcSet' ] ,
62
+ summary : [ ...aria ] ,
63
+ table : [ ...aria ] ,
64
+ // Note: this class is not normally allowed by GH, when manually writing
65
+ // `ol` as HTML in markdown, they adds it some other way.
66
+ // We can’t do that, so we have to allow it.
67
+ ul : [ ...aria , [ 'className' , 'contains-task-list' ] ] ,
30
68
'*' : [
31
69
'abbr' ,
32
70
'accept' ,
@@ -35,10 +73,6 @@ export const defaultSchema = {
35
73
'action' ,
36
74
'align' ,
37
75
'alt' ,
38
- 'ariaDescribedBy' ,
39
- 'ariaHidden' ,
40
- 'ariaLabel' ,
41
- 'ariaLabelledBy' ,
42
76
'axis' ,
43
77
'border' ,
44
78
'cellPadding' ,
@@ -94,16 +128,14 @@ export const defaultSchema = {
94
128
'tabIndex' ,
95
129
'target' ,
96
130
'title' ,
97
- 'type' ,
98
131
'useMap' ,
99
132
'vAlign' ,
100
- 'vSpace' ,
101
133
'value' ,
102
134
'width'
103
135
]
104
136
} ,
105
137
clobberPrefix : 'user-content-' ,
106
- clobber : [ 'id' , 'name' ] ,
138
+ clobber : [ 'ariaDescribedBy' , 'ariaLabelledBy' , ' id', 'name' ] ,
107
139
protocols : {
108
140
href : [ 'http' , 'https' , 'irc' , 'ircs' , 'mailto' , 'xmpp' ] ,
109
141
cite : [ 'http' , 'https' ] ,
@@ -116,24 +148,17 @@ export const defaultSchema = {
116
148
strip : [ 'script' ] ,
117
149
tagNames : [
118
150
'a' ,
119
- 'abbr' ,
120
151
'b' ,
121
- 'bdo' ,
122
152
'blockquote' ,
123
153
'br' ,
124
- 'caption' ,
125
- 'cite' ,
126
154
'code' ,
127
155
'dd' ,
128
156
'del' ,
129
157
'details' ,
130
- 'dfn' ,
131
158
'div' ,
132
159
'dl' ,
133
160
'dt' ,
134
161
'em' ,
135
- 'figcaption' ,
136
- 'figure' ,
137
162
'h1' ,
138
163
'h2' ,
139
164
'h3' ,
@@ -143,21 +168,25 @@ export const defaultSchema = {
143
168
'hr' ,
144
169
'i' ,
145
170
'img' ,
171
+ // Note: `input` is not normally allowed by GH, when manually writing
172
+ // it in markdown, they add it from tasklists some other way.
173
+ // We can’t do that, so we have to allow it.
146
174
'input' ,
147
175
'ins' ,
148
176
'kbd' ,
149
177
'li' ,
150
- 'mark' ,
151
178
'ol' ,
152
179
'p' ,
180
+ 'picture' ,
153
181
'pre' ,
154
182
'q' ,
155
183
'rp' ,
156
184
'rt' ,
157
185
'ruby' ,
158
186
's' ,
159
187
'samp' ,
160
- 'small' ,
188
+ 'section' ,
189
+ 'source' ,
161
190
'span' ,
162
191
'strike' ,
163
192
'strong' ,
@@ -170,11 +199,9 @@ export const defaultSchema = {
170
199
'tfoot' ,
171
200
'th' ,
172
201
'thead' ,
173
- 'time' ,
174
202
'tr' ,
175
203
'tt' ,
176
204
'ul' ,
177
- 'var' ,
178
- 'wbr'
205
+ 'var'
179
206
]
180
207
}
0 commit comments