Skip to content

Commit 053aa13

Browse files
Add h2 anchors where missing
1 parent e046701 commit 053aa13

File tree

8 files changed

+55
-9
lines changed

8 files changed

+55
-9
lines changed

_includes/new-includes/components/linux-releases.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ <h2>RPM</h2>
7979
</details>
8080
</div>
8181
</div>
82-
<h2>Development Snapshots</h2>
82+
<h2 id="development-snapshots" class="header-with-anchor">Development Snapshots</h2>
8383
<div>
8484
<p class="content-copy">Swift snapshots are prebuilt binaries that are automatically created from the branch. These snapshots are not official releases. They have gone through automated unit testing, but they have not gone through the full testing that is performed for official releases.</p>
8585
</div>

assets/javascripts/new-javascripts/application.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,24 @@ if (codeBoxes.length) {
112112
})
113113
})
114114
}
115+
116+
document.querySelectorAll('h2.header-with-anchor').forEach(header => {
117+
if (!header.id) return;
118+
119+
const link = document.createElement('a');
120+
link.href = `#${header.id}`;
121+
link.title = `Permalink for ${header.textContent}`;
122+
link.innerHTML = `<svg
123+
width="24px"
124+
height="24px"
125+
viewBox="0 0 14 14"
126+
role="img"
127+
focusable="false"
128+
aria-hidden="true"
129+
xmlns="http://www.w3.org/2000/svg">
130+
<path d="m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z"/>
131+
</svg>
132+
`;
133+
134+
header.appendChild(link);
135+
});

assets/stylesheets/new-stylesheets/_core.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,24 @@ code {
5757
serif;
5858
font-weight: 400;
5959
}
60+
61+
.header-with-anchor {
62+
scroll-margin-top: 80px;
63+
64+
a {
65+
display: none;
66+
margin-left: 0.2em;
67+
68+
svg {
69+
filter: var(--icon-filter);
70+
}
71+
}
72+
}
73+
74+
h2.header-with-anchor {
75+
&:hover {
76+
a {
77+
display: inline-block;
78+
}
79+
}
80+
}

assets/stylesheets/new-stylesheets/_themes.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
--exception-page-bg: #fac685;
2626

27+
--icon-filter: none;
28+
--icon-filter-hover: invert(1);
29+
2730
--install-page-bg: linear-gradient(0deg, #f6b391 0%, #f8ce6e 92%);
2831
--install-site-code-box-bg: #ffffff;
2932
--install-site-code-box-pre-bg: #f2f2f2;
@@ -128,6 +131,9 @@
128131

129132
--exception-page-bg: #23344a;
130133

134+
--icon-filter: invert(1);
135+
--icon-filter-hover: none;
136+
131137
--install-page-bg: linear-gradient(0deg, #ff8115 0%, #b7451b 92%);
132138
--install-site-code-box-bg: #23344a;
133139
--install-site-code-box-pre-bg: #111727;

documentation/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ If you are new to Swift, you may want to check out these additional resources.
1111
</div>
1212

1313
{%- for category in site.data.documentation %}
14-
<h2>
15-
{{ category.header }}
16-
</h2>
14+
## {{ category.header }}
1715
<div>
1816
{%- for entry in category.pages %}
1917
<div>

install/linux/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ title: Install Swift - Linux
2626
{% include new-includes/components/code-box.html content = site.data.new-data.install.windows.releases.latest-release.vscode%}
2727
</div>
2828
</div>
29-
<h2>Development Snapshots</h2>
29+
<h2 id="development-snapshots" class="header-with-anchor">Development Snapshots</h2>
3030
<div>
3131
<p class="content-copy">Swift snapshots are prebuilt binaries that are automatically created from the branch. These snapshots are not official releases. They have gone through automated unit testing, but they have not gone through the full testing that is performed for official releases.</p>
3232
</div>

install/macos/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ title: Install Swift - macOS
5050
</details>
5151
</div>
5252
</div>
53-
<h2>Development Snapshots</h2>
53+
<h2 id="development-snapshots" class="header-with-anchor">Development Snapshots</h2>
5454
<div>
5555
<p class="content-copy">Swift snapshots are prebuilt binaries that are automatically created from the branch. These snapshots are not official releases. They have gone through automated unit testing, but they have not gone through the full testing that is performed for official releases.</p>
5656
<p class="content-copy">The easiest way to install development snapshots is with the Swiftly tool. Read more on the <a href="/install/macos/swiftly">instructions page</a>.</p>

install/windows/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ title: Install Swift - Windows
2323
{% include new-includes/components/code-box.html content = site.data.new-data.install.windows.releases.latest-release.vscode%}
2424
</div>
2525
</div>
26-
<h2>Alternative install options</h2>
26+
<h2 id="alternative-install-options" class="header-with-anchor">Alternative install options</h2>
2727
<div class="releases-grid">
2828
<div class="release-box section">
2929
<div class="content">
@@ -61,7 +61,7 @@ title: Install Swift - Windows
6161
</div>
6262
</div>
6363
</div>
64-
<h2>Previous Releases</h2>
64+
<h2 id="previous-releases" class="header-with-anchor">Previous Releases</h2>
6565
<div>
6666
<p class="content-copy">Previous releases of Swift are available for installation on Windows using the manual installer, <a href="/install/windows/archived">as documented here</a>.</p>
6767
</div>
@@ -73,7 +73,7 @@ title: Install Swift - Windows
7373
</details>
7474
</div>
7575
</div>
76-
<h2>Development Snapshots</h2>
76+
<h2 id="development-snapshots" class="header-with-anchor">Development Snapshots</h2>
7777
<div>
7878
<p class="content-copy">Swift snapshots are prebuilt binaries that are automatically created from the branch. These snapshots are not official releases. They have gone through automated unit testing, but they have not gone through the full testing that is performed for official releases.</p>
7979
</div>

0 commit comments

Comments
 (0)