Skip to content

Commit 7a4ad1d

Browse files
authored
Merge pull request #13 from Wolf2323/externalLinkIcons
fixed external link icons
2 parents 7d8520b + e959c04 commit 7a4ad1d

7 files changed

+51
-25
lines changed

docs/_custom_theme/externalLinkIcon.html

-25
This file was deleted.
+8
Loading
Loading
Loading
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
body .md-content__inner a.external-link:not(.md-button,.noExternalLinkIcon) {
2+
background-image: url("/_media/content/linkExternalWhite.svg");
3+
background-repeat: no-repeat;
4+
background-position: top right;
5+
padding-right: 0.7em;
6+
background-size: 0.6em;
7+
8+
&[data-md-color-scheme="slate"] {
9+
background-image: url("/_media/content/linkExternalDark.svg");
10+
}
11+
12+
&:hover {
13+
background-image: url("/_media/content/linkExternalHover.svg");
14+
}
15+
}

docs/_webCode/js/externalLinkIcon.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const currentDomain = window.location.origin;
2+
const links = document.querySelectorAll(".md-content__inner a");
3+
console.log("currentDomain: ", currentDomain);
4+
5+
links.forEach(link => {
6+
const href = link.href;
7+
if (!href.startsWith(currentDomain)) {
8+
link.classList.add("external-link");
9+
}
10+
});

docs/mkdocs_parent.yml

+2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ extra_css:
1111
- '_webCode/css/contentAreaFullWidth.css'
1212
- '_webCode/css/coloredIcons.css'
1313
- '_webCode/css/mermaidCentered.css'
14+
- '_webCode/css/externalLinkIcon.css'
1415

1516
extra_javascript:
1617
- '_webCode/js/copyLinkToClipboard.js'
1718
- '_webCode/js/copyrightYearUpdater.js'
1819
- '_webCode/js/mathjax.js'
20+
- '_webCode/js/externalLinkIcon.js'
1921
- https://polyfill.io/v3/polyfill.min.js?features=es6
2022
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
2123

0 commit comments

Comments
 (0)