Skip to content

Commit

Permalink
Merge pull request #13 from Wolf2323/externalLinkIcons
Browse files Browse the repository at this point in the history
fixed external link icons
  • Loading branch information
Wolf2323 authored Dec 4, 2024
2 parents 7d8520b + e959c04 commit 7a4ad1d
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 25 deletions.
25 changes: 0 additions & 25 deletions docs/_custom_theme/externalLinkIcon.html

This file was deleted.

8 changes: 8 additions & 0 deletions docs/_media/content/linkExternalDark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/_media/content/linkExternalHover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/_media/content/linkExternalWhite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/_webCode/css/externalLinkIcon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
body .md-content__inner a.external-link:not(.md-button,.noExternalLinkIcon) {
background-image: url("/_media/content/linkExternalWhite.svg");
background-repeat: no-repeat;
background-position: top right;
padding-right: 0.7em;
background-size: 0.6em;

&[data-md-color-scheme="slate"] {
background-image: url("/_media/content/linkExternalDark.svg");
}

&:hover {
background-image: url("/_media/content/linkExternalHover.svg");
}
}
10 changes: 10 additions & 0 deletions docs/_webCode/js/externalLinkIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const currentDomain = window.location.origin;
const links = document.querySelectorAll(".md-content__inner a");
console.log("currentDomain: ", currentDomain);

links.forEach(link => {
const href = link.href;
if (!href.startsWith(currentDomain)) {
link.classList.add("external-link");
}
});
2 changes: 2 additions & 0 deletions docs/mkdocs_parent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ extra_css:
- '_webCode/css/contentAreaFullWidth.css'
- '_webCode/css/coloredIcons.css'
- '_webCode/css/mermaidCentered.css'
- '_webCode/css/externalLinkIcon.css'

extra_javascript:
- '_webCode/js/copyLinkToClipboard.js'
- '_webCode/js/copyrightYearUpdater.js'
- '_webCode/js/mathjax.js'
- '_webCode/js/externalLinkIcon.js'
- https://polyfill.io/v3/polyfill.min.js?features=es6
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

Expand Down

0 comments on commit 7a4ad1d

Please sign in to comment.