From 54efa4c1af0da33eff9ac57ef15a1418c163685a Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Wed, 17 Jun 2026 14:59:00 +0200 Subject: [PATCH] fix: examples download buttons --- doc/source/_static/js/download.js | 6 ++++++ doc/source/changelog/1033.fixed.md | 1 + doc/source/conf.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 doc/source/_static/js/download.js create mode 100644 doc/source/changelog/1033.fixed.md diff --git a/doc/source/_static/js/download.js b/doc/source/_static/js/download.js new file mode 100644 index 0000000000..b3651cd201 --- /dev/null +++ b/doc/source/_static/js/download.js @@ -0,0 +1,6 @@ +// Force download for .ipynb links instead of rendering them in the browser. +document.addEventListener("DOMContentLoaded", function () { + document.querySelectorAll('a[href$=".ipynb"]').forEach(function (link) { + link.setAttribute("download", ""); + }); +}); diff --git a/doc/source/changelog/1033.fixed.md b/doc/source/changelog/1033.fixed.md new file mode 100644 index 0000000000..447107890f --- /dev/null +++ b/doc/source/changelog/1033.fixed.md @@ -0,0 +1 @@ +Download example files diff --git a/doc/source/conf.py b/doc/source/conf.py index 3e29d14be5..f4ceb2763e 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -83,7 +83,7 @@ "css/search.css", "css/datatable.css", ] -html_js_files = [] +html_js_files = ["js/download.js"] # disable including and linking the reST sources in HTML builds html_copy_source = False