File: furo_js_as_module.patch

package info (click to toggle)
furo 2025.09.25%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,704 kB
  • sloc: python: 681; javascript: 397; makefile: 37; sh: 25
file content (27 lines) | stat: -rw-r--r-- 1,261 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
furo.js is added as:
<script src="_static/scripts/furo.js" type="module"></script>
app.add_js_file parameters are appended the keyword type, which
is allowed per the documentation of add_js_file; see:
https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_js_file

Index: furo/src/furo/__init__.py
===================================================================
--- furo.orig/src/furo/__init__.py
+++ furo/src/furo/__init__.py
@@ -267,8 +267,15 @@ def _builder_inited(app: sphinx.applicat
             "This should not happen."
         )
 
+    # furo.js is added as:
+    # <script src="_static/scripts/furo.js" type="module"></script>
+    # app.add_js_file parameters are appended the keyword type, which
+    # is allowed per the documentation of add_js_file; see:
+    # https://www.sphinx-doc.org/en/master/extdev/appapi.html
+    # at the anchor: sphinx.application.Sphinx.add_js_file
+    #
     # Our JS file needs to be loaded as soon as possible.
-    app.add_js_file("scripts/furo.js", priority=200)
+    app.add_js_file("scripts/furo.js", priority=200, type="module")
 
     # 500 is the default priority for extensions, we want this after this.
     app.add_css_file("styles/furo-extensions.css", priority=600)