Documentation Index
Fetch the complete documentation index at: https://mintlify.com/xwmx/nb/llms.txt
Use this file to discover all available pages before exploring further.
nb has a first-class plugin system built directly on the CLI itself. Plugins are plain Bash scripts with a .nb-plugin extension that can define new subcommands, add functionality, and interact with every nb feature using the same internal functions that nb uses internally. Because the API is just the CLI — accessed through underscore-prefixed function names — plugins are composable, portable, and easy to write.
How the API Works
Thenb API is the command line interface itself. Within plugins, every nb subcommand is available as a Bash function named with a leading underscore (_):
nb also automatically scans all arguments for selectors containing notebook names and updates the current notebook context when a valid one is found, so your plugin inherits the same selector resolution as built-in subcommands.
Plugin File Structure
Plugins are Bash-compatible shell scripts with a.nb-plugin file extension. A minimal plugin is created in three steps.
Define help and usage text
Use
_subcommands describe with a heredoc to provide help text shown by nb help example:nb example prints Hello, World!.
Core API Functions
_show — Query Item Information
_show <selector> [options] retrieves information about a specific item identified by a selector. The output format is controlled by option flags:
_notebooks — Notebook Information
_list — List Items
Other Subcommands
Anynb subcommand is accessible via its underscore-prefixed function name:
Resolving Selectors to File Paths
A common pattern in plugins is accepting a selector argument and resolving it to a filename and notebook path so you can operate on the actual file:_show <selector> --filename paired with _notebooks current --path — is the standard way to bridge selector-based addressing and direct filesystem access within a plugin.
Subcommand Aliases
Plugins can also register command aliases using_subcommands alias:
Complete Minimal Plugin Example
Installing Plugins
- From a URL
- From a local path
- Install a theme
${NB_DIR}/.plugins/ and are listed with nb plugins:
Example Plugins to Study
example.nb-plugin
The minimal reference plugin — a great starting point for writing your own.
clip.nb-plugin
Adds clipboard functionality, demonstrating
_show, _notebooks current --path, and selector resolution.ebook.nb-plugin
A full-featured plugin showing how to orchestrate multiple
nb subcommands in a complex workflow.