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

default | emacs | friendly | friendly_grayscale | colorful | autumn | murphy | manni | material | monokai | perldoc | pastie | borland | trac | native | fruity | bw | vim | vs | tango | rrt | xcode | igor | paraiso-light | paraiso-dark | lovelace | algol | algol_nu | arduino | rainbow_dash | abap | solarized-dark | solarized-light | sas | stata | stata-light | stata-dark | inkpot | zenburn | gruvbox-dark | gruvbox-light | dracula | one-dark | lilypond | 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>#

Install completion for the specified shell.

Options

bash | zsh | fish | powershell | pwsh

--show-completion <show_completion>#

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

Options

bash | zsh | fish | powershell | pwsh

Arguments

FILE#

Optional argument(s)

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_HYPERLINKS

Provide a default for --hyperlinks

NBPREVIEW_HIDE_HYPERLINK_HINTS

Provide a default for --hide-hyperlink-hints

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