Usage

nbpreview has only one required argument—FILE—which expects a Jupyter notebook (.ipynb) file path. FILE is a flexible argument. It can take:

  • A Jupyter notebook (ipynb) file path

  • Multiple notebook paths

  • Take in input from stdin

For more details, see features.

nbpreview also comes with a convenient alias—nbp. Invoke either nbpreview

% nbpreview notebook.ipynb

or nbp

% nbp notebook.ipynb

on the command-line to run the program.

--help

To read the documentation on all options, their effects, values, and environmental variables, run

% nbpreview --help

nbpreview

Render a Jupyter Notebook in the terminal.

nbpreview [OPTIONS] [FILE]...

Options

-t, --theme <theme>

The theme to use for syntax highlighting. Call --list-themes to preview all available themes.

Default:

'dark'

Options:

abap | algol | algol_nu | arduino | autumn | bw | borland | coffee | colorful | default | dracula | emacs | friendly_grayscale | friendly | fruity | github-dark | gruvbox-dark | gruvbox-light | igor | inkpot | lightbulb | lilypond | lovelace | manni | material | monokai | murphy | native | nord-darker | nord | one-dark | paraiso-dark | paraiso-light | pastie | perldoc | rainbow_dash | rrt | sas | solarized-dark | solarized-light | staroffice | stata-dark | stata-light | tango | trac | vim | vs | xcode | zenburn | a11y-dark | a11y-high-contrast-dark | a11y-high-contrast-light | a11y-light | blinds-dark | blinds-light | github-dark-colorblind | github-dark-high-contrast | github-light | github-light-colorblind | github-light-high-contrast | gotthard-dark | gotthard-light | greative | pitaya-smoothie | light | dark | ansi_light | ansi_dark

--list-themes, --lt

Display a preview of all available themes.

-p, --plain, -d, --decorated

Whether to render in a plain style with no boxes, execution counts, or spacing. By default detected depending on usage context.

-u, --unicode, -x, --no-unicode

Force the display or replacement of Unicode characters instead of determining automatically.

-h, --hide-output

Whether to hide the notebook outputs.

Default:

False

-n, --nerd-font

Whether to use Nerd Font icons.

Default:

False

-l, --no-files

Do not write temporary files for previews.

Default:

False

-s, --positive-space

Draw character images in positive space. Generally, negative space works best on charts or images with light backgrounds, while positive space will look best on dark background images. Only affects character drawings. By default set to negative space.

Default:

False

-k, --hyperlinks, -r, --no-hyperlinks

Whether to use terminal hyperlinks when rendering content. By default autodetects.

-y, --hide-hyperlink-hints

Hide text hints that hyperlinks are clickable.

Default:

False

-i, --images, -e, --no-images

Whether to render images. By default will autodetect. May significantly affect performance.

--image-drawing, --id <image_drawing>

The type of image drawing. Accepted values are ‘block’, ‘character’, or ‘braille’.

Options:

block | character | braille

-c, --color, -o, --no-color

Whether to render with color. By default will autodetect. Additionally respects NO_COLOR, NBPREVIEW_NO_COLOR, and TERM=’dumb’.

--color-system, --cs <color_system>

The type of color system to use.

Options:

standard | 256 | truecolor | windows | none | auto

-w, --width <width>

Explicitly set the width of the render instead of determining automatically.

-V, --version

Display the version and exit.

-m, --line-numbers

Show line numbers for code in cells.

Default:

False

-q, --code-wrap

Wrap code onto the next line if it does not fit in width. May be used with --line-numbers for clarity.

Default:

False

-g, --paging, -f, --no-paging

Whether to display the output in a pager. By default autodetects.

--install-completion

Install completion for the current shell.

--show-completion

Show completion for the current shell, to copy it or customize the installation.

Arguments

FILE

Optional argument(s)

Jupyter notebook file(s) to render on the terminal. Use a dash (‘-’) or pipe in data to the command to read from standard input.

Environment variables

NBPREVIEW_THEME

Provide a default for --theme

NBPREVIEW_PLAIN

Provide a default for --plain

NBPREVIEW_UNICODE

Provide a default for --unicode

NBPREVIEW_HIDE_OUTPUT

Provide a default for --hide-output

NBPREVIEW_NERD_FONT

Provide a default for --nerd-font

NBPREVIEW_NO_FILES

Provide a default for --no-files

NBPREVIEW_POSITIVE_SPACE

Provide a default for --positive-space

NBPREVIEW_IMAGES

Provide a default for --images

NBPREVIEW_IMAGE_DRAWING

Provide a default for --image-drawing

NBPREVIEW_COLOR

Provide a default for --color

NBPREVIEW_COLOR_SYSTEM

Provide a default for --color-system

NBPREVIEW_WIDTH

Provide a default for --width

NBPREVIEW_LINE_NUMBERS

Provide a default for --line-numbers

NBPREVIEW_CODE_WRAP

Provide a default for --code-wrap

NBPREVIEW_PAGING

Provide a default for --paging