|
| 1 | +# IRSA MyST Plugins |
| 2 | + |
| 3 | +Custom [MyST](https://mystmd.org) plugins for the irsa-tutorials. |
| 4 | + |
| 5 | +## Building |
| 6 | + |
| 7 | +```bash |
| 8 | +cd plugins |
| 9 | +npm install |
| 10 | +npm run build |
| 11 | +``` |
| 12 | + |
| 13 | +This bundles `src/notebook-gallery.mjs` into `dist/notebook-gallery.mjs`. Must *re-run* after any changes to `src/`. |
| 14 | + |
| 15 | +## Registering with MyST |
| 16 | + |
| 17 | +Add the built bundle to `myst.yml`: |
| 18 | + |
| 19 | +```yaml |
| 20 | +project: |
| 21 | + plugins: |
| 22 | + - plugins/dist/notebook-gallery.mjs |
| 23 | +``` |
| 24 | +
|
| 25 | +--- |
| 26 | +
|
| 27 | +## Plugin: `notebook-gallery` directive |
| 28 | + |
| 29 | +Renders a list of notebooks as a responsive grid of clickable cards. Each card shows a title and a one-sentence description pulled from a shared metadata file. |
| 30 | + |
| 31 | +### Metadata file |
| 32 | + |
| 33 | +The directive argument is a path to a YAML or JSON file (relative to the repo root) that lists notebook metadata. Each entry must have at least: |
| 34 | + |
| 35 | +| Field | Type | Description | |
| 36 | +| ------------- | ------ | ---------------------------------------------------- | |
| 37 | +| `file` | string | Path to the notebook relative to the repo root | |
| 38 | +| `title` | string | Display title shown in the card header | |
| 39 | +| `description` | string | One-sentence summary shown in the card body | |
| 40 | + |
| 41 | +Example `notebook_metadata.yml`: |
| 42 | + |
| 43 | +```yaml |
| 44 | +- file: tutorials/wise/wise_catalog_search.md |
| 45 | + title: WISE Catalog Search |
| 46 | + description: Search the AllWISE catalog using astroquery. |
| 47 | +- file: tutorials/euclid/1_Euclid_intro_MER_images.md |
| 48 | + title: Euclid MER Images |
| 49 | + description: Access and visualise Euclid Q1 MER mosaic images. |
| 50 | +``` |
| 51 | + |
| 52 | +### Directive syntax |
| 53 | + |
| 54 | +````markdown |
| 55 | +```{notebook-gallery} notebook_metadata.yml |
| 56 | +tutorials/wise/wise_catalog_search.md |
| 57 | +tutorials/euclid/1_Euclid_intro_MER_images.md |
| 58 | +``` |
| 59 | +```` |
| 60 | + |
| 61 | +- The **argument** (on the opening fence line) is the path to the metadata file. |
| 62 | +- The **body** lists one notebook path per line (matching the `file` field in the metadata). Lines starting with `#` are treated as comments. |
| 63 | + |
| 64 | +### Error handling |
| 65 | + |
| 66 | +| Situation | Rendered output | |
| 67 | +| ----------------------------------- | -------------------------------------------------------- | |
| 68 | +| Metadata file not found / unreadable | An `{error}` admonition with the bad path | |
| 69 | +| Notebook path not in metadata | A warning card: _⚠️ Unrecognised notebook_ | |
0 commit comments