about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorWill Crichton <wcrichto@cs.stanford.edu>2022-12-06 09:34:37 -0800
committerWill Crichton <wcrichto@cs.stanford.edu>2022-12-07 09:08:43 -0800
commit679d7ea064491dfc8d067fcef07827e7569a093e (patch)
tree225a436a36c374bdc4b3aab0e286a8afdeb08c04 /src
parent45742170741d6c6b9abda5fc51012a01ce1c704a (diff)
downloadrust-679d7ea064491dfc8d067fcef07827e7569a093e.tar.gz
rust-679d7ea064491dfc8d067fcef07827e7569a093e.zip
Include additional documentation for scrape-examples changes
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css6
-rw-r--r--src/librustdoc/html/static/js/scrape-examples.js4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index ec941c3a938..0432d445d53 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1817,9 +1817,12 @@ in storage.js
 
 /* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
 @media (min-width: 701px) {
+	/* Places file-link for a scraped example on top of the example to save space.
+	   We only do this on large screens so the file-link doesn't overlap too much
+		 with the example's content. */
 	.scraped-example-title {
 		position: absolute;
-		z-index: 1000;
+		z-index: 10;
 		background: var(--main-background-color);
 		bottom: 8px;
 		right: 5px;
@@ -1915,6 +1918,7 @@ in storage.js
 }
 
 .scraped-example {
+	/* So .scraped-example-title can be positioned absolutely */
 	position: relative;
 }
 
diff --git a/src/librustdoc/html/static/js/scrape-examples.js b/src/librustdoc/html/static/js/scrape-examples.js
index 82b71ad0fca..d179909ac7f 100644
--- a/src/librustdoc/html/static/js/scrape-examples.js
+++ b/src/librustdoc/html/static/js/scrape-examples.js
@@ -3,7 +3,9 @@
 "use strict";
 
 (function() {
-    // Number of lines shown when code viewer is not expanded
+    // Number of lines shown when code viewer is not expanded.
+    // DEFAULT is the first example shown by default, while HIDDEN is
+    // the examples hidden beneath the "More examples" toggle.
     const DEFAULT_MAX_LINES = 5;
     const HIDDEN_MAX_LINES = 10;