File tree 1 file changed +9
-3
lines changed 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,13 @@ static ADMONITION_RE: LazyLock<Regex> = LazyLock::new(|| {
11
11
Regex :: new ( r"(?m)^ *> \[!(?<admon>[^]]+)\]\n(?<blockquote>(?: *>.*\n)+)" ) . unwrap ( )
12
12
} ) ;
13
13
14
+
15
+ // This icon is from GitHub, MIT License, see https://github.com/primer/octicons
16
+ const ICON_NOTE : & str = r#"<path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path>"# ;
17
+
18
+ // This icon is from GitHub, MIT License, see https://github.com/primer/octicons
19
+ const ICON_WARNING : & str = r#"<path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>"# ;
20
+
14
21
/// Converts blockquotes with special headers into admonitions.
15
22
///
16
23
/// The blockquote should look something like:
@@ -43,10 +50,9 @@ pub fn admonitions(chapter: &Chapter, diag: &mut Diagnostics) -> String {
43
50
{space}</div>\n ") ;
44
51
}
45
52
46
- // These icons are from GitHub, MIT License, see https://github.com/primer/octicons
47
53
let svg = match lower. as_str ( ) {
48
- "note" => "<path d= \" M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z \" ></path>" ,
49
- "warning" => "<path d= \" M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z \" ></path>" ,
54
+ "note" => ICON_NOTE ,
55
+ "warning" => ICON_WARNING ,
50
56
_ => {
51
57
warn_or_err ! (
52
58
diag,
You can’t perform that action at this time.
0 commit comments