Skip to content

Commit

Permalink
๐Ÿšธ Open external links in a new window
Browse files Browse the repository at this point in the history
See: https://github.com/JakubAndrysek/mkdocs-open-in-new-tab

๐Ÿ’„ Materialize external links with a right upward arrow

INFO:

This does NOT work if you are accesing the site via Gitub Pages:
    https://USERNAME.github.io/trio-docs/

It works when accessing the site via https://docs.diy-trio.org/
or previewing the site locally with `mkdocs serve`.

Why?
Mkdocs-open-in-new-tab uses an absolute URL '/js/open_in_new_tab.js'
This URL won't work when deployed in a sub-folder.

โœ…            https://docs.diy-trio.org/js/open_in_new_tab.js
โœ…                http://127.0.0.1:8000/js/open_in_new_tab.js
โŒ    https://ericbouchut.com/trio-docs/js/open_in_new_tab.js
โŒ https://ebouchut.github.io/trio-docs/js/open_in_new_tab.js
  • Loading branch information
ebouchut committed Oct 16, 2024
1 parent 521594d commit a42e286
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/assets/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
* Materialize links that open in a new window/tab with a right-up arrow icon
*/
a[target="_blank"]::after {
content: "โ†—";
display: inline-block;
margin-left: 0.2em;
width: 1em;
height: 1em;
}

/*
* Add admonition type: important (red exclamation sign)
* See: https://squidfunk.github.io/mkdocs-material/reference/admonitions/#custom-admonitions
Expand Down
Empty file added docs/js/.keep
Empty file.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ theme:
- toc.integrate

plugins:
- open-in-new-tab
- macros:
include_dir: .
- exporter:
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ mkdocs-exporter==6.1.1
mkdocs-material>=9.5.9
mkdocs-include-markdown-plugin>=6.0.4
mkdocs-exclude>=1.0.2
mkdocs-open-in-new-tab==1.0.6
mkdocs-macros-plugin>=1.0.4
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mkdocs-include-markdown-plugin==6.2.2
mkdocs-macros-plugin==1.3.5
mkdocs-material==9.5.40
mkdocs-material-extensions==1.3.1
mkdocs-open-in-new-tab==1.0.6
packaging==24.1
paginate==0.5.7
pathspec==0.12.1
Expand Down

0 comments on commit a42e286

Please sign in to comment.