@@ -122,7 +122,8 @@ html_template = """
122
122
</script>
123
123
124
124
<!-- Load IPywidgets bundle for embedding. -->
125
- <script
125
+ <script
126
+ data-jupyter-widgets-cdn="https://cdn.jsdelivr.net/npm/"
126
127
src="https://unpkg.com/@jupyter-widgets/html-manager@*/dist/embed-amd.js"
127
128
crossorigin="anonymous">
128
129
</script>
@@ -177,6 +178,9 @@ In this example, we used a Python string for the template, and used the
177
178
documents, you may want to use a templating engine like
178
179
[ Jinja2] ( http://jinja.pocoo.org/ ) .
179
180
181
+ We also change the CDN from its default of unpkg to use jsdelivr by setting the
182
+ ` data-jupyter-widgets-cdn ` attribute.
183
+
180
184
In all embedding functions in ` ipywidgets.embed ` , the state of all widgets
181
185
known to the widget manager is included by default. You can alternatively
182
186
pass a reduced state to use instead. This can be particularly relevant if you
@@ -262,13 +266,17 @@ documentation. An illustration of this is the http://jupyter.org/widgets
262
266
gallery.
263
267
264
268
The widget embedder attempts to fetch the model and view implementation of the
265
- custom widget from the npm CDN https:// unpkg.com. The URL that is requested
269
+ custom widget from the npm CDN https:// unpkg.com by default . The URL that is requested
266
270
for , e.g. the `bqplot` module name, with the semver range `^ 2.0 .0` is
267
271
268
272
`https:// unpkg.com/ bqplot@ ^ 2.0 .0/ dist/ index.js`
269
273
270
274
which holds the webpack bundle for the bqplot library.
271
275
276
+ While the default CDN is using https:// unpkg.com it can be configured by
277
+ setting the optional `data- jupyter- widgets- cdn` attribute for script tag which loads `embed- amd.js` ,
278
+ as shown in the example above.
279
+
272
280
The [widget- cookiecutter](https:// github.com/ jupyter/ widget- cookiecutter)
273
281
template project contains a template project for a custom widget library
274
282
following the best practices for authoring widgets, which ensure that your
0 commit comments