Skip to content

Add glue and paste functionality

Compare
Choose a tag to compare
@chrisjsewell chrisjsewell released this 14 Mar 02:56
· 301 commits to master since this release
b45660e

This adds a prototype functionality for "glue and paste" with MyST-NB. It closes #4

You glue things into a notebook's metadata like this:

from myst_nb import glue
glue("your-key", an_object)

And it will run IPython's display on the object, then store the mimebundle
at the key you specify.

When the notebooks are parsed with MyST-NB, it builds up a registry of all
the keys across all notebooks, so that you can then refer to them in the following ways:

You can paste it in markdown with a directive like this:

```{paste} your-key
```

Or you can add it in-line like this:

{paste}`your-key`

optionally:

{paste}`your-key:format-string`

See documentation for more details: https://myst-nb.readthedocs.io/en/latest/use/glue.html