Skip to content

jupyter-book/example-js-anywidget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyST JS Anywidget

An example of a MyST JS Anywidget that renders a button which, when pressed, emits confetti (see widget.mjs). This widget uses esbuild to bundle dependencies.

Build the bundle

The esbuild tool takes widget.mjs and its dependencies as inputs, and generates a dist/widget.mjs bundle. This bundle can be directly loaded by MyST without requiring a build or install step.

The build script defined in package.json shows an example of using esbuild to generate an mjs module. It can be invoked by running

npm run build

Using the bundled plugin

The output MyST anywidget can be loaded into a MyST project via an anywidget directive. You can publish the built plugin to a public artifact repository, such as a GitHub Release artifact, and users can directly link to it in their anywidget directive:

```{anywidget} https://github.com/jupyter-book/example-js-anywidget/releases/latest/download/widget.mjs
{}
```

About

A demonstration JS anywidget for use with the MyST Document Engine

Topics

Resources

Stars

Watchers

Forks

Contributors