Skip to content

Commit 35a7c1b

Browse files
Fix position of scraped examples title on mobile devices
1 parent 84259ff commit 35a7c1b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,6 +2267,17 @@ in src-script.js and main.js
22672267
margin: 0;
22682268
padding: var(--nav-sub-mobile-padding);
22692269
}
2270+
2271+
.example-wrap.scraped-example {
2272+
flex-wrap: wrap;
2273+
}
2274+
.example-wrap .scraped-example-title {
2275+
width: 100%;
2276+
}
2277+
.example-wrap.scraped-example .rust {
2278+
/* Dirty hacky to force it to remain on the same line as the line numbers. */
2279+
width: 10px;
2280+
}
22702281
}
22712282

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

src/librustdoc/html/templates/scraped_source.html

Lines changed: 3 additions & 3 deletions
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)