Skip to content

Commit dfdec97

Browse files
Change the button location
new file: _resourcepdf/overrides/partials/toc.html modified: docs/css/extra.css modified: mkdocs-base.yml
1 parent c9d6aaa commit dfdec97

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{% if page.toc %}
2+
<nav class="md-nav md-nav--secondary">
3+
<label class="md-nav__title" for="__toc">Table of contents</label>
4+
<ul class="md-nav__list" data-md-scrollfix>
5+
{% for toc_item in page.toc %}
6+
{% include "partials/toc-item.html" with context %}
7+
{% endfor %}
8+
</ul>
9+
10+
{# Edit this page link below the TOC #}
11+
{% if page.edit_url %}
12+
<div class="md-source-file">
13+
<a href="{{ page.edit_url }}" title="Improve this page" class="edit-page-box">
14+
<span class="edit-page-icon">
15+
{% set icon = config.theme.icon.edit or "material/file-edit-outline" %}
16+
{% include ".icons/" ~ icon ~ ".svg" %}
17+
</span>
18+
<span class="edit-page-text">Improve this page</span>
19+
</a>
20+
</div>
21+
{% endif %}
22+
</nav>
23+
{% endif %}

docs/css/extra.css

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,25 @@
1111
line-height: 1.6;
1212
}
1313

14-
.md-content__button.md-icon {
15-
color: #127ae8 !important; /* Example: deep orange */
14+
.edit-page-icon svg {
15+
width: 1.7em;
16+
height: 1.7em;
17+
margin-right: 0.4em;
18+
fill: currentColor; /* Makes icon match text color */
1619
}
1720

18-
/* Optional: hover effect */
19-
.md-content__button.md-icon:hover {
20-
color: #439eff !important;
21-
}
22-
23-
.md-content__button.md-icon svg {
24-
width: 34px;
25-
height: 34px;
26-
}
27-
28-
.md-content__button.md-icon[href*="/edit/"] {
29-
display: inline-flex; /* make the button a flex container */
30-
flex-direction: column; /* stack children vertically */
31-
align-items: center; /* center them horizontally */
32-
margin-top: -4px;
33-
}
34-
35-
.md-content__button.md-icon[href*="/edit/"] svg {
36-
width: 34px;
37-
height: 34px;
38-
}
39-
40-
.md-content__button.md-icon[href*="/edit/"]::after {
41-
content: "Improve this page";
42-
margin-top: 2px;
43-
font-size: 0.7rem;
44-
color: #2C323E;
45-
text-align: center;
46-
display: block;
47-
width: 100%;
21+
.edit-page-box {
22+
display: inline-flex;
23+
align-items: center;
24+
padding: 0.5em 0.75em;
25+
border: 2px solid #439eff;
26+
border-radius: 6px;
4827
font-weight: bold;
49-
}
50-
28+
font-size: 1.1em;
29+
color: #127ae8;
30+
min-width: 250px;
31+
justify-content: center;
32+
text-decoration: none;
33+
transition: background-color 0.2s, color 0.2s;
34+
margin-top: 0rem;
35+
}

mkdocs-base.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ theme:
5151
- navigation.indexes
5252
- content.tooltips
5353
- content.tabs.link
54-
- content.action.edit
55-
# - content.action.view
54+
# - content.action.edit
55+
- content.action.view
5656
- content.code.copy
5757
- content.code.annotate
5858
- toc.follow

0 commit comments

Comments
 (0)