]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/html/static/css/rustdoc.css
Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514
[rust.git] / src / librustdoc / html / static / css / rustdoc.css
index 341d9b80fd82d8091ba5d81ef30439c5843cfe66..8139f115cbb392abfb75ac1f4298ac94a89efbd9 100644 (file)
        font-display: swap;
 }
 
-/* Avoid using legacy CJK serif fonts in Windows like Batang */
+/* Avoid using legacy CJK serif fonts in Windows like Batang. */
 @font-face {
        font-family: 'Noto Sans KR';
-       src: url("noto-sans-kr-v13-korean-regular.woff") format("woff");
+       src: url("noto-sans-kr-regular.woff2") format("woff2"),
+               url("noto-sans-kr-regular.woff") format("woff");
        font-display: swap;
-       unicode-range: U+A960-A97F, U+AC00-D7AF, U+D7B0-D7FF;
+       unicode-range: U+AC00-D7AF, U+3130-318F, U+1100-11FF, U+A960-A97F, U+D7B0-D7FF;
 }
 
 * {
@@ -126,11 +127,16 @@ h2 {
 h3 {
        font-size: 1.3em;
 }
-h1, h2, h3, h4 {
+h1, h2, h3, h4, h5, h6 {
        font-weight: 500;
+}
+h1, h2, h3, h4 {
        margin: 20px 0 15px 0;
        padding-bottom: 6px;
 }
+h5, h6 {
+       margin: 15px 0 5px 0;
+}
 h1.fqn {
        display: flex;
        border-bottom: 1px dashed;
@@ -179,7 +185,7 @@ div.impl-items > div {
        padding-left: 0;
 }
 
-h1, h2, h3, h4,
+h1, h2, h3, h4, h5, h6,
 .sidebar, a.source, .search-input, .search-results .result-name,
 .content table td:first-child > a,
 .item-left > a,
@@ -253,7 +259,10 @@ code, pre, a.test-arrow, .code-header {
 pre {
        padding: 14px;
 }
-.type-decl pre {
+.docblock.item-decl {
+       margin-left: 0;
+}
+.item-decl pre {
        overflow-x: auto;
 }
 
@@ -458,6 +467,11 @@ nav.sub {
        overflow-x: auto;
 }
 
+.rustdoc:not(.source) .example-wrap > pre.line-numbers {
+       width: auto;
+       overflow-x: visible;
+}
+
 .rustdoc .example-wrap > pre {
        margin: 0;
 }
@@ -501,21 +515,18 @@ nav.sub {
        white-space: pre-wrap;
 }
 
-.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 {
-       border-bottom: 1px solid;
-}
-
-.top-doc .docblock h1 { font-size: 1.3em; }
-.top-doc .docblock h2 { font-size: 1.15em; }
-.top-doc .docblock h3,
+.top-doc .docblock h2 { font-size: 1.3em; }
+.top-doc .docblock h3 { font-size: 1.15em; }
 .top-doc .docblock h4,
 .top-doc .docblock h5 {
+       font-size: 1.1em;
+}
+.top-doc .docblock h6 {
        font-size: 1em;
 }
 
-.docblock h1 { font-size: 1em; }
-.docblock h2 { font-size: 0.95em; }
-.docblock h3, .docblock h4, .docblock h5 { font-size: 0.9em; }
+.docblock h5 { font-size: 1em; }
+.docblock h6 { font-size: 0.95em; }
 
 .docblock {
        margin-left: 24px;
@@ -550,6 +561,7 @@ nav.sub {
        flex-grow: 1;
        margin: 0px;
        padding: 0px;
+       overflow-wrap: anywhere;
 }
 
 .in-band > code, .in-band > .code-header {
@@ -773,9 +785,7 @@ h2.small-section-header > .anchor {
 .block a.current.crate { font-weight: 500; }
 
 .item-table {
-       display: table-row;
-       /* align content left */
-       justify-items: start;
+       display: table;
 }
 .item-row {
        display: table-row;
@@ -1970,4 +1980,171 @@ details.undocumented[open] > summary::before {
        .docblock {
                margin-left: 12px;
        }
+
+       .docblock code {
+               overflow-wrap: anywhere;
+       }
+}
+
+
+/* Begin: styles for --scrape-examples feature */
+
+.scraped-example-title {
+       font-family: 'Fira Sans';
+}
+
+.scraped-example:not(.expanded) .code-wrapper pre.line-numbers {
+       overflow: hidden;
+       max-height: 240px;
+}
+
+.scraped-example:not(.expanded) .code-wrapper .example-wrap pre.rust {
+       overflow-y: hidden;
+       max-height: 240px;
+       padding-bottom: 0;
+}
+
+.scraped-example .code-wrapper .prev {
+       position: absolute;
+       top: 0.25em;
+       right: 2.25em;
+       z-index: 100;
+       cursor: pointer;
+}
+
+.scraped-example .code-wrapper .next {
+       position: absolute;
+       top: 0.25em;
+       right: 1.25em;
+       z-index: 100;
+       cursor: pointer;
 }
+
+.scraped-example .code-wrapper .expand {
+       position: absolute;
+       top: 0.25em;
+       right: 0.25em;
+       z-index: 100;
+       cursor: pointer;
+}
+
+.scraped-example .code-wrapper {
+       position: relative;
+       display: flex;
+       flex-direction: row;
+       flex-wrap: wrap;
+       width: 100%;
+}
+
+.scraped-example:not(.expanded) .code-wrapper:before {
+       content: " ";
+       width: 100%;
+       height: 5px;
+       position: absolute;
+       z-index: 100;
+       top: 0;
+       background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
+}
+
+.scraped-example:not(.expanded) .code-wrapper:after {
+       content: " ";
+       width: 100%;
+       height: 5px;
+       position: absolute;
+       z-index: 100;
+       bottom: 0;
+       background: linear-gradient(to top, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
+}
+
+.scraped-example:not(.expanded) .code-wrapper {
+       overflow: hidden;
+       max-height: 240px;
+}
+
+.scraped-example .code-wrapper .line-numbers {
+       margin: 0;
+       padding: 14px 0;
+}
+
+.scraped-example .code-wrapper .line-numbers span {
+       padding: 0 14px;
+}
+
+.scraped-example .code-wrapper .example-wrap {
+       flex: 1;
+       overflow-x: auto;
+       overflow-y: hidden;
+       margin-bottom: 0;
+}
+
+.scraped-example .code-wrapper .example-wrap pre.rust {
+       overflow-x: inherit;
+       width: inherit;
+       overflow-y: hidden;
+}
+
+.scraped-example .example-wrap .rust span.highlight {
+       background: #fcffd6;
+}
+
+.scraped-example .example-wrap .rust span.highlight.focus {
+       background: #f6fdb0;
+}
+
+.more-examples-toggle {
+       margin-top: 10px;
+}
+
+.more-examples-toggle summary {
+       color: #999;
+       font-family: 'Fira Sans';
+}
+
+.more-scraped-examples {
+       margin-left: 25px;
+       display: flex;
+       flex-direction: row;
+       width: calc(100% - 25px);
+}
+
+.more-scraped-examples-inner {
+       /* 20px is width of toggle-line + toggle-line-inner */
+       width: calc(100% - 20px);
+}
+
+.toggle-line {
+       align-self: stretch;
+       margin-right: 10px;
+       margin-top: 5px;
+       padding: 0 4px;
+       cursor: pointer;
+}
+
+.toggle-line:hover .toggle-line-inner {
+       background: #aaa;
+}
+
+.toggle-line-inner {
+       min-width: 2px;
+       background: #ddd;
+       height: 100%;
+}
+
+.more-scraped-examples .scraped-example {
+       margin-bottom: 20px;
+}
+
+.more-scraped-examples .scraped-example:last-child {
+       margin-bottom: 0;
+}
+
+.example-links a {
+       margin-top: 20px;
+       font-family: 'Fira Sans';
+}
+
+.example-links ul {
+       margin-bottom: 0;
+}
+
+/* End: styles for --scrape-examples feature */