File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,8 @@ impl<'a> MarkdownRenderer<'a> {
94
94
. cloned ( )
95
95
. collect ( ) ;
96
96
let mut html_sanitizer = Builder :: new ( ) ;
97
- html_sanitizer. link_rel ( Some ( "nofollow noopener noreferrer" ) )
97
+ html_sanitizer
98
+ . link_rel ( Some ( "nofollow noopener noreferrer" ) )
98
99
. tags ( tags)
99
100
. tag_attributes ( tag_attributes)
100
101
. allowed_classes ( allowed_classes)
@@ -221,13 +222,19 @@ mod tests {
221
222
fn header_has_tags ( ) {
222
223
let text = "# My crate\n \n Hello, world!\n " ;
223
224
let result = markdown_to_html ( text) . unwrap ( ) ;
224
- assert_eq ! ( result, "<h1><a href=\" #my-crate\" id=\" user-content-my-crate\" rel=\" nofollow noopener noreferrer\" ></a>My crate</h1>\n <p>Hello, world!</p>\n " ) ;
225
+ assert_eq ! (
226
+ result,
227
+ "<h1><a href=\" #my-crate\" id=\" user-content-my-crate\" rel=\" nofollow noopener noreferrer\" ></a>My crate</h1>\n <p>Hello, world!</p>\n "
228
+ ) ;
225
229
}
226
230
227
231
#[ test]
228
232
fn manual_anchor_is_sanitized ( ) {
229
233
let text = "<h1><a href=\" #my-crate\" id=\" my-crate\" ></a>My crate</h1>\n <p>Hello, world!</p>\n " ;
230
234
let result = markdown_to_html ( text) . unwrap ( ) ;
231
- assert_eq ! ( result, "<h1><a href=\" #my-crate\" id=\" user-content-my-crate\" rel=\" nofollow noopener noreferrer\" ></a>My crate</h1>\n <p>Hello, world!</p>\n " ) ;
235
+ assert_eq ! (
236
+ result,
237
+ "<h1><a href=\" #my-crate\" id=\" user-content-my-crate\" rel=\" nofollow noopener noreferrer\" ></a>My crate</h1>\n <p>Hello, world!</p>\n "
238
+ ) ;
232
239
}
233
240
}
You can’t perform that action at this time.
0 commit comments