Skip to content

Commit

Permalink
use javascript to open new tab for external links (#5159)
Browse files Browse the repository at this point in the history
Signed-off-by: cosmicBboy <[email protected]>
  • Loading branch information
cosmicBboy authored Mar 31, 2024
1 parent f5f8230 commit b1cab3a
Show file tree
Hide file tree
Showing 5 changed files with 10,968 additions and 1,158 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ install-conda-lock:

.PHONY: conda-lock
conda-lock: install-conda-lock
conda-lock -f monodocs-environment.yaml --without-cuda --lockfile monodocs-environment.lock.yaml
conda-lock -f monodocs-environment.yaml --without-cuda \
--lockfile monodocs-environment.lock.yaml \
--platform=osx-64 --platform=osx-arm64 --platform=linux-64

.PHONY: stats
stats:
Expand Down
11 changes: 11 additions & 0 deletions docs/_static/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Add event listener for DOMContentLoaded event
window.addEventListener("DOMContentLoaded", function() {
// Select all <a> elements with class "external"
var externalLinks = document.querySelectorAll("a.external");

// Loop through each <a> element with class "external"
externalLinks.forEach(function(link) {
// Set the target attribute to "_blank"
link.setAttribute("target", "_blank");
});
});
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
# custom extensions
"auto_examples",
"import_projects",
"sphinx_new_tab_link"
]

source_suffix = {
Expand Down Expand Up @@ -188,6 +187,7 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_css_files = ["custom.css", "flyte.css", "algolia.css"]
html_js_files = ["custom.js"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand Down
Loading

0 comments on commit b1cab3a

Please sign in to comment.