Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lecture videos and slide decks are written as two MyST directives, {nma-video} and {nma-slides}. They render as plain embeds on the website, so readers see them right away without starting the in-browser kernel. In the Colab/Kaggle notebooks they become the usual hidden # @title Video … cells. Per-section feedback works the same way, with {nma-feedback}.

Videos

:::{nma-video} Video 1: Linear Dynamical Systems
:youtube: 87z6OR7-DBI
:bilibili: BV1up4y1S7wj
:::

renders as:

Video 1: Linear Dynamical Systems

YouTube
Bilibili

Video available at https://youtube.com/watch?v=87z6OR7-DBI

Video available at https://www.bilibili.com/video/BV1up4y1S7wj

Slides

:::{nma-slides} snv4m
:::

renders as:

Tutorial slides

Download the slides

The argument is the OSF file id. :title: overrides the default heading “Tutorial slides”.

Feedback

:::{nma-feedback} Linear_Dynamical_Systems_Video
:::

renders a row of 🙂 😐 🙁 buttons (see any section of W2D1 Tutorial 1). 🙂 is sent right away. 😐 and 🙁 first ask for a comment. The widget is plain JavaScript, so it works before the kernel starts, and it posts straight to the datatops project that the Neuromatch notebooks already use.

Rules

What the notebook gets

nma-kit notebooks replaces each directive with a hidden code cell (cellView: form, hide-input). For videos, that cell builds the YouTube/Bilibili ipywidgets Tab used in all Neuromatch notebooks. For slides, it shows an OSF IFrame and prints the download link. For feedback, it is the usual # @title Submit your feedback / content_review(...) cell, and one hidden “Import feedback gadget” cell at the top of the notebook installs vibecheck and sets feedback_prefix.

How it works

Both sides live in the course kit (neuromatch/course-kit):

WhereCourse kit fileJob
Websitejs/src/media/plugin.mjs (part of the kit’s MyST plugin, listed in myst.yml under project.plugins)Turns directives into iframes and tabs during myst build
Notebookspython/src/nma_kit/media.pyValidates directives and replaces them with code cells
Websitejs/src/feedback/plugin.mjs and js/src/feedback/assets/widget.mjsThe feedback widget, loaded in the browser through MyST’s anywidget node
Notebookspython/src/nma_kit/feedback.pyValidates {nma-feedback} and the nma: settings, writes the feedback cells

Adding a new video host is a course kit change in both files: add the embed and page URL in VIDEO_SOURCES in media/plugin.mjs, and the option and label in VIDEO_SOURCES in media.py, plus a branch in the generated PlayVideo class.

Converting an existing NMA notebook

Replace each # @title Video … cell with an {nma-video}, copying the ids from its video_ids = [...] line. Replace the # @title Tutorial slides cell with {nma-slides}, using its link_id. Replace each “Submit your feedback” cell with {nma-feedback}, using the part of content_review(f"{feedback_prefix}_…") after the underscore, and delete the “Import feedback gadget” cell. Set feedback_prefix in the frontmatter if the notebook’s prefix differs from the one derived from the file name. CI rejects any leftover content_review or vibecheck code.