@@ -91,6 +91,9 @@ title: s1/p3
91
91
[430](p2/)
92
92
[440](/s1/p2/)
93
93
[450](../s1/p2/)
94
+
95
+ // empty
96
+ []()
94
97
`
95
98
96
99
b := hugolib .Test (t , files )
@@ -122,6 +125,8 @@ title: s1/p3
122
125
`<a href="/s1/p2/">430</a>` ,
123
126
`<a href="/s1/p2/">440</a>` ,
124
127
`<a href="/s1/p2/">450</a>` ,
128
+
129
+ `<a href=""></a>` ,
125
130
)
126
131
127
132
b .AssertFileContent ("public/s1/p2/index.html" ,
@@ -148,10 +153,17 @@ block = false
148
153
[markup.goldmark.renderHooks.image]
149
154
enableDefault = true
150
155
-- content/p1/index.md --
156
+ ![]()
157
+
151
158

152
159
153
- 
160
+ 
161
+
162
+ 
154
163
{.foo #bar}
164
+
165
+ 
166
+ {id="\"><script>alert()</script>"}
155
167
-- content/p1/pixel.png --
156
168
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
157
169
-- layouts/_default/single.html --
@@ -160,15 +172,21 @@ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAA
160
172
161
173
b := hugolib .Test (t , files )
162
174
b .AssertFileContent ("public/p1/index.html" ,
163
- `<img alt="alt1" src="/dir/p1/pixel.png">` ,
164
- `<img alt="alt2" src="/dir/p1/pixel.png?a=b&c=d#fragment">` ,
175
+ `<img src="" alt="">` ,
176
+ `<img src="/dir/p1/pixel.png" alt="alt1">` ,
177
+ `<img src="/dir/p1/pixel.png" alt="alt2-&<>’" title="&<>'">` ,
178
+ `<img src="/dir/p1/pixel.png?a=b&c=d#fragment" alt="alt3">` ,
179
+ `<img src="/dir/p1/pixel.png" alt="alt4">` ,
165
180
)
166
181
167
182
files = strings .Replace (files , "block = false" , "block = true" , - 1 )
168
183
169
184
b = hugolib .Test (t , files )
170
185
b .AssertFileContent ("public/p1/index.html" ,
171
- `<img alt="alt1" src="/dir/p1/pixel.png">` ,
172
- `<img alt="alt2" class="foo" id="bar" src="/dir/p1/pixel.png?a=b&c=d#fragment">` ,
186
+ `<img src="" alt="">` ,
187
+ `<img src="/dir/p1/pixel.png" alt="alt1">` ,
188
+ `<img src="/dir/p1/pixel.png" alt="alt2-&<>’" title="&<>'">` ,
189
+ `<img src="/dir/p1/pixel.png?a=b&c=d#fragment" alt="alt3" class="foo" id="bar">` ,
190
+ `<img src="/dir/p1/pixel.png" alt="alt4" id=""><script>alert()</script>">` ,
173
191
)
174
192
}
0 commit comments