Skip to content

Commit 096bf4e

Browse files
Fix position of scraped examples title on mobile devices
1 parent 2abe3e9 commit 096bf4e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/librustdoc/html/static/css/rustdoc.css

+11
Original file line numberDiff line numberDiff line change
@@ -2264,6 +2264,17 @@ in src-script.js and main.js
22642264
margin: 0;
22652265
padding: var(--nav-sub-mobile-padding);
22662266
}
2267+
2268+
.example-wrap.scraped-example {
2269+
flex-wrap: wrap;
2270+
}
2271+
.example-wrap .scraped-example-title {
2272+
width: 100%;
2273+
}
2274+
.example-wrap.scraped-example .rust {
2275+
/* Dirty hacky to force it to remain on the same line as the line numbers. */
2276+
width: 10px;
2277+
}
22672278
}
22682279

22692280
/* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */

src/librustdoc/html/templates/scraped_source.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<div class="example-wrap scraped-example{% if !info.needs_expansion +%} expanded{% endif %}" data-locs="{{info.locations}}">
2+
<div class="scraped-example-title">
3+
{{info.name +}} (<a href="{{info.url}}">{{info.title}}</a>) {# #}
4+
</div>
25
{# https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr
36
Do not show "1 2 3 4 5 ..." in web search results. #}
47
<div data-nosnippet><pre class="src-line-numbers">
@@ -12,9 +15,6 @@
1215
{{code_html|safe}}
1316
</code> {# #}
1417
</pre> {# #}
15-
<div class="scraped-example-title">
16-
{{info.name +}} (<a href="{{info.url}}">{{info.title}}</a>) {# #}
17-
</div>
1818
{% if info.needs_prev_next_buttons || info.needs_expansion %}
1919
<div class="button-holder">
2020
{% if info.needs_prev_next_buttons %}

0 commit comments

Comments
 (0)