Skip to content

Commit 042cedc

Browse files
author
craigsdennis
committed
Open all links in new tab/window
1 parent a3f3965 commit 042cedc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: th-script-snippet.html

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script type="text/javascript">
22
// In order to override default notebook styles we need a specific class on our markdown area
3-
const els = document.getElementsByClassName('markdown-zone');
4-
for (let i = 0; i < els.length; i++) {
5-
els[i].classList.add('markdown--jupyter-notebook');
6-
}
7-
</script>
3+
document.querySelectorAll('.markdown-zone').forEach(el => {
4+
el.classList.add('markdown--jupyter-notebook');
5+
// And I want all child links to open a new tab
6+
el.querySelectorAll('a').forEach(a => a.setAttribute('target', '_blank'));
7+
});
8+
</script>
9+

0 commit comments

Comments
 (0)