@@ -2,7 +2,7 @@ use crate::web::highlight;
2
2
use comrak:: {
3
3
ExtensionOptions , Options , Plugins , RenderPlugins , adapters:: SyntaxHighlighterAdapter ,
4
4
} ;
5
- use std:: collections:: HashMap ;
5
+ use std:: { collections:: HashMap , fmt } ;
6
6
7
7
#[ derive( Debug ) ]
8
8
struct CodeAdapter < F > ( F , Option < & ' static str > ) ;
@@ -12,10 +12,10 @@ impl<F: Fn(Option<&str>, &str, Option<&str>) -> String + Send + Sync> SyntaxHigh
12
12
{
13
13
fn write_highlighted (
14
14
& self ,
15
- output : & mut dyn std :: io :: Write ,
15
+ output : & mut dyn fmt :: Write ,
16
16
lang : Option < & str > ,
17
17
code : & str ,
18
- ) -> std :: io :: Result < ( ) > {
18
+ ) -> Result < ( ) , fmt :: Error > {
19
19
// comrak does not treat `,` as an info-string delimiter, so we do that here
20
20
// TODO: https://github.com/kivikakk/comrak/issues/246
21
21
let lang = lang. and_then ( |lang| lang. split ( ',' ) . next ( ) ) ;
@@ -24,17 +24,17 @@ impl<F: Fn(Option<&str>, &str, Option<&str>) -> String + Send + Sync> SyntaxHigh
24
24
25
25
fn write_pre_tag (
26
26
& self ,
27
- output : & mut dyn std :: io :: Write ,
27
+ output : & mut dyn fmt :: Write ,
28
28
attributes : HashMap < String , String > ,
29
- ) -> std :: io :: Result < ( ) > {
29
+ ) -> Result < ( ) , fmt :: Error > {
30
30
write_opening_tag ( output, "pre" , & attributes)
31
31
}
32
32
33
33
fn write_code_tag (
34
34
& self ,
35
- output : & mut dyn std :: io :: Write ,
35
+ output : & mut dyn fmt :: Write ,
36
36
attributes : HashMap < String , String > ,
37
- ) -> std :: io :: Result < ( ) > {
37
+ ) -> Result < ( ) , fmt :: Error > {
38
38
// similarly to above, since comrak does not treat `,` as an info-string delimiter it will
39
39
// try to apply `class="language-rust,ignore"` for the info-string `rust,ignore`, so we
40
40
// have to detect that case and fixup the class here
@@ -54,10 +54,10 @@ impl<F: Fn(Option<&str>, &str, Option<&str>) -> String + Send + Sync> SyntaxHigh
54
54
}
55
55
56
56
fn write_opening_tag (
57
- output : & mut dyn std :: io :: Write ,
57
+ output : & mut dyn fmt :: Write ,
58
58
tag : & str ,
59
59
attributes : & HashMap < String , String > ,
60
- ) -> std :: io :: Result < ( ) > {
60
+ ) -> Result < ( ) , fmt :: Error > {
61
61
write ! ( output, "<{tag}" ) ?;
62
62
for ( attr, val) in attributes {
63
63
write ! ( output, " {attr}=\" {val}\" " ) ?;
0 commit comments