]> git.lizzy.rs Git - rust.git/blob - src/librustdoc/html/static_files.rs
Rollup merge of #99671 - TaKO8Ki:suggest-dereferencing-index, r=compiler-errors
[rust.git] / src / librustdoc / html / static_files.rs
1 //! Static files bundled with documentation output.
2 //!
3 //! All the static files are included here for centralized access in case anything other than the
4 //! HTML rendering code (say, the theme checker) needs to access one of these files.
5 //!
6 //! Note about types: CSS and JavaScript files are included as `&'static str` to allow for the
7 //! minifier to run on them. All other files are included as `&'static [u8]` so they can be
8 //! directly written to a `Write` handle.
9
10 /// The file contents of the main `rustdoc.css` file, responsible for the core layout of the page.
11 pub(crate) static RUSTDOC_CSS: &str = include_str!("static/css/rustdoc.css");
12
13 /// The file contents of `settings.css`, responsible for the items on the settings page.
14 pub(crate) static SETTINGS_CSS: &str = include_str!("static/css/settings.css");
15
16 /// The file contents of the `noscript.css` file, used in case JS isn't supported or is disabled.
17 pub(crate) static NOSCRIPT_CSS: &str = include_str!("static/css/noscript.css");
18
19 /// The file contents of `normalize.css`, included to even out standard elements between browser
20 /// implementations.
21 pub(crate) static NORMALIZE_CSS: &str = include_str!("static/css/normalize.css");
22
23 /// The file contents of `main.js`, which contains the core JavaScript used on documentation pages,
24 /// including search behavior and docblock folding, among others.
25 pub(crate) static MAIN_JS: &str = include_str!("static/js/main.js");
26
27 /// The file contents of `search.js`, which contains the search behavior.
28 pub(crate) static SEARCH_JS: &str = include_str!("static/js/search.js");
29
30 /// The file contents of `settings.js`, which contains the JavaScript used to handle the settings
31 /// page.
32 pub(crate) static SETTINGS_JS: &str = include_str!("static/js/settings.js");
33
34 /// The file contents of `storage.js`, which contains functionality related to browser Local
35 /// Storage, used to store documentation settings.
36 pub(crate) static STORAGE_JS: &str = include_str!("static/js/storage.js");
37
38 /// The file contents of `scraped-examples.js`, which contains functionality related to the
39 /// --scrape-examples flag that inserts automatically-found examples of usages of items.
40 pub(crate) static SCRAPE_EXAMPLES_JS: &str = include_str!("static/js/scrape-examples.js");
41
42 pub(crate) static SCRAPE_EXAMPLES_HELP_MD: &str = include_str!("static/scrape-examples-help.md");
43
44 /// The file contents of `wheel.svg`, the icon used for the settings button.
45 pub(crate) static WHEEL_SVG: &[u8] = include_bytes!("static/images/wheel.svg");
46
47 /// The file contents of `clipboard.svg`, the icon used for the "copy path" button.
48 pub(crate) static CLIPBOARD_SVG: &[u8] = include_bytes!("static/images/clipboard.svg");
49
50 /// The file contents of `down-arrow.svg`, the icon used for the crate choice combobox.
51 pub(crate) static DOWN_ARROW_SVG: &[u8] = include_bytes!("static/images/down-arrow.svg");
52
53 /// The file contents of `toggle-minus.svg`, the icon used for opened toggles.
54 pub(crate) static TOGGLE_MINUS_PNG: &[u8] = include_bytes!("static/images/toggle-minus.svg");
55
56 /// The file contents of `toggle-plus.svg`, the icon used for closed toggles.
57 pub(crate) static TOGGLE_PLUS_PNG: &[u8] = include_bytes!("static/images/toggle-plus.svg");
58
59 /// The contents of `COPYRIGHT.txt`, the license listing for files distributed with documentation
60 /// output.
61 pub(crate) static COPYRIGHT: &[u8] = include_bytes!("static/COPYRIGHT.txt");
62
63 /// The contents of `LICENSE-APACHE.txt`, the text of the Apache License, version 2.0.
64 pub(crate) static LICENSE_APACHE: &[u8] = include_bytes!("static/LICENSE-APACHE.txt");
65
66 /// The contents of `LICENSE-MIT.txt`, the text of the MIT License.
67 pub(crate) static LICENSE_MIT: &[u8] = include_bytes!("static/LICENSE-MIT.txt");
68
69 /// The contents of `rust-logo.svg`, the default icon of the documentation.
70 pub(crate) static RUST_LOGO_SVG: &[u8] = include_bytes!("static/images/rust-logo.svg");
71
72 /// The default documentation favicons (SVG and PNG fallbacks)
73 pub(crate) static RUST_FAVICON_SVG: &[u8] = include_bytes!("static/images/favicon.svg");
74 pub(crate) static RUST_FAVICON_PNG_16: &[u8] = include_bytes!("static/images/favicon-16x16.png");
75 pub(crate) static RUST_FAVICON_PNG_32: &[u8] = include_bytes!("static/images/favicon-32x32.png");
76
77 /// The built-in themes given to every documentation site.
78 pub(crate) mod themes {
79     /// The "light" theme, selected by default when no setting is available. Used as the basis for
80     /// the `--check-theme` functionality.
81     pub(crate) static LIGHT: &str = include_str!("static/css/themes/light.css");
82
83     /// The "dark" theme.
84     pub(crate) static DARK: &str = include_str!("static/css/themes/dark.css");
85
86     /// The "ayu" theme.
87     pub(crate) static AYU: &str = include_str!("static/css/themes/ayu.css");
88 }
89
90 /// Files related to the Fira Sans font.
91 pub(crate) mod fira_sans {
92     /// The file `FiraSans-Regular.woff2`, the Regular variant of the Fira Sans font in woff2.
93     pub(crate) static REGULAR: &[u8] = include_bytes!("static/fonts/FiraSans-Regular.woff2");
94
95     /// The file `FiraSans-Medium.woff2`, the Medium variant of the Fira Sans font in woff2.
96     pub(crate) static MEDIUM: &[u8] = include_bytes!("static/fonts/FiraSans-Medium.woff2");
97
98     /// The file `FiraSans-LICENSE.txt`, the license text for the Fira Sans font.
99     pub(crate) static LICENSE: &[u8] = include_bytes!("static/fonts/FiraSans-LICENSE.txt");
100 }
101
102 /// Files related to the Source Serif 4 font.
103 pub(crate) mod source_serif_4 {
104     /// The file `SourceSerif4-Regular.ttf.woff2`, the Regular variant of the Source Serif 4 font in
105     /// woff2.
106     pub(crate) static REGULAR: &[u8] =
107         include_bytes!("static/fonts/SourceSerif4-Regular.ttf.woff2");
108
109     /// The file `SourceSerif4-Bold.ttf.woff2`, the Bold variant of the Source Serif 4 font in
110     /// woff2.
111     pub(crate) static BOLD: &[u8] = include_bytes!("static/fonts/SourceSerif4-Bold.ttf.woff2");
112
113     /// The file `SourceSerif4-It.ttf.woff2`, the Italic variant of the Source Serif 4 font in
114     /// woff2.
115     pub(crate) static ITALIC: &[u8] = include_bytes!("static/fonts/SourceSerif4-It.ttf.woff2");
116
117     /// The file `SourceSerif4-LICENSE.txt`, the license text for the Source Serif 4 font.
118     pub(crate) static LICENSE: &[u8] = include_bytes!("static/fonts/SourceSerif4-LICENSE.md");
119 }
120
121 /// Files related to the Source Code Pro font.
122 pub(crate) mod source_code_pro {
123     /// The file `SourceCodePro-Regular.ttf.woff2`, the Regular variant of the Source Code Pro font
124     /// in woff2.
125     pub(crate) static REGULAR: &[u8] =
126         include_bytes!("static/fonts/SourceCodePro-Regular.ttf.woff2");
127
128     /// The file `SourceCodePro-Semibold.ttf.woff2`, the Semibold variant of the Source Code Pro
129     /// font in woff2.
130     pub(crate) static SEMIBOLD: &[u8] =
131         include_bytes!("static/fonts/SourceCodePro-Semibold.ttf.woff2");
132
133     /// The file `SourceCodePro-It.ttf.woff2`, the Italic variant of the Source Code Pro font in
134     /// woff2.
135     pub(crate) static ITALIC: &[u8] = include_bytes!("static/fonts/SourceCodePro-It.ttf.woff2");
136
137     /// The file `SourceCodePro-LICENSE.txt`, the license text of the Source Code Pro font.
138     pub(crate) static LICENSE: &[u8] = include_bytes!("static/fonts/SourceCodePro-LICENSE.txt");
139 }
140
141 /// Files related to the Nanum Barun Gothic font.
142 ///
143 /// These files are used to avoid some legacy CJK serif fonts in Windows.
144 ///
145 /// Note that the Noto Sans KR font, which was used previously but was not very readable on Windows,
146 /// has been replaced by the Nanum Barun Gothic font. This is due to Windows' implementation of font
147 /// rendering that distorts OpenType fonts too much.
148 ///
149 /// The font files were generated with these commands:
150 ///
151 /// ```sh
152 /// pyftsubset NanumBarunGothic.ttf \
153 /// --unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \
154 /// --output-file=NanumBarunGothic.ttf.woff2 --flavor=woff2
155 /// ```
156 pub(crate) mod nanum_barun_gothic {
157     /// The file `NanumBarunGothic.ttf.woff2`, the Regular variant of the Nanum Barun Gothic font.
158     pub(crate) static REGULAR: &[u8] = include_bytes!("static/fonts/NanumBarunGothic.ttf.woff2");
159
160     /// The file `NanumBarunGothic-LICENSE.txt`, the license text of the Nanum Barun Gothic font.
161     pub(crate) static LICENSE: &[u8] = include_bytes!("static/fonts/NanumBarunGothic-LICENSE.txt");
162 }
163
164 /// Files related to the sidebar in rustdoc sources.
165 pub(crate) mod sidebar {
166     /// File script to handle sidebar.
167     pub(crate) static SOURCE_SCRIPT: &str = include_str!("static/js/source-script.js");
168 }