https://github.com/xwmx/nb
CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
https://github.com/xwmx/nb
archiving bash bookmark-manager bookmarks cli command-line git knowledge-base markdown note-taking notebook notes notes-app pandoc productivity shell sync vim vscode zettelkasten
Last synced: about 1 year ago
JSON representation
CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
- Host: GitHub
- URL: https://github.com/xwmx/nb
- Owner: xwmx
- License: agpl-3.0
- Created: 2016-01-12T17:27:26.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-05-07T07:59:12.000Z (about 1 year ago)
- Last Synced: 2025-05-07T11:41:46.410Z (about 1 year ago)
- Topics: archiving, bash, bookmark-manager, bookmarks, cli, command-line, git, knowledge-base, markdown, note-taking, notebook, notes, notes-app, pandoc, productivity, shell, sync, vim, vscode, zettelkasten
- Language: Shell
- Homepage: https://xwmx.github.io/nb
- Size: 9.19 MB
- Stars: 7,044
- Watchers: 77
- Forks: 195
- Open Issues: 128
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- definitive-opensource - nb
- awesome-note-taking - nb - A command line and local web note‑taking, bookmarking, archiving, and knowledge base application (Open Source / CLI)
- awesome-cli-tui-software - xwmx/nb - CLI plain-text note-taking, bookmarking, and archiving with encryption, filtering and search, Git-backed versioning and syncing, Pandoc-backed conversion, and more in a single portable script. (<a name="data"></a>data)
- fucking-awesome-cli-apps - nb - A note‑taking, bookmarking, archiving, and knowledge base application. (Productivity / Note Taking and Lists)
- awesome-cli-apps - nb - A note‑taking, bookmarking, archiving, and knowledge base application. (Productivity / Note Taking and Lists)
- awesome-terminals - nb - CLI plain-text note-taking, bookmarking, and archiving with encryption, filtering and search, Git-backed versioning and syncing, Pandoc-backed conversion, and more in a single portable script. [https://xwmx.github.io/nb/](https://xwmx.github.io/nb/) (Tools / sh)
- StarryDivineSky - xwmx/nb
- awesome-starred - xwmx/nb - CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script. (git)
- jimsghstars - xwmx/nb - CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script. (Shell)
- awesome-cli-apps-in-a-csv - nb - A command line and local web note-taking, bookmarking, archiving, and knowledge base application. (<a name="note-taking"></a>Note taking)
- awesome-zettelkasten - nb
- awesome-cli-apps - nb - A command line and local web note-taking, bookmarking, archiving, and knowledge base application. (<a name="note-taking"></a>Note taking)
- awesome-markdown - nb - 一款命令行和本地网络笔记应用,它以**纯文本格式**存储笔记,支持 **Markdown、Org、LaTeX** 等多种格式。其核心特色在于集成了 **Git 版本控制、加密**、强大的**书签管理**和 **Pandoc 转换**等功能,让用户可以在终端中高效地记录、管理和同步笔记,是极客风格的知识管理工具。     (其他工具 / 命令行工具)
- awesome-github-repos - xwmx/nb - CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script. (Shell)
- my-awesome - xwmx/nb - manager,bookmarks,cli,command-line,git,knowledge-base,markdown,note-taking,notebook,notes,notes-app,pandoc,productivity,shell,sync,vim,vscode,zettelkasten pushed_at:2026-04 star:8.1k fork:0.2k CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script. (Shell)
- awesome-cli - xwmx/nb - taking, bookmarking, and archiving | (Note Taking & Knowledge)
- Awesome-desktop-notes - nb - CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script. ([↑](#-contents) Free)
README
`nb` is a command line and local web
note‑taking, bookmarking, archiving,
and knowledge base application
with:
- plain text data storage,
- [encryption](#password-protected-encrypted-notes-and-bookmarks),
- [filtering](#listing--filtering), [pinning](#-pinning), [#tagging](#-tagging), and [search](#-search),
- [Git](https://git-scm.com/)-backed [versioning](#-revision-history) and [syncing](#-git-sync),
- [Pandoc](https://pandoc.org/)-backed [conversion](#%EF%B8%8F-import--export),
- [[wiki-style linking]],
- terminal and GUI web [browsing](#-browsing),
- inline [images](#-images),
- [todos](#-todos) with [tasks](#%EF%B8%8F-tasks),
- global and local [notebooks](#-notebooks),
- organization with [folders](#-folders),
- customizable [color themes](#-color-themes),
- extensibility through [plugins](#-plugins),
and more, in a single portable script.
`nb` creates notes in text-based formats like
[Markdown](https://en.wikipedia.org/wiki/Markdown),
[Org](https://orgmode.org/),
[LaTeX](https://www.latex-project.org/),
and [AsciiDoc](https://asciidoc.org/),
can work with files in any format,
can import and export notes to many document formats,
and can create private, password-protected encrypted notes and bookmarks.
With `nb`, you can write notes using
Vim,
Emacs,
VS Code,
Sublime Text,
and any other text editor you like,
as well as terminal and GUI web browsers.
`nb` works in any standard Linux / Unix environment,
including macOS and Windows via WSL, MSYS, and Cygwin.
[Optional dependencies](#optional) can be installed to enhance functionality,
but `nb` works great without them.
`nb` is also a powerful [bookmarking](#-bookmarks) system featuring:
- locally-served, text-centric, distraction-free bookmark [browsing](#-browsing)
in terminal and GUI web browsers,
- local full-text search of cached page content with regular expression support,
- convenient filtering and listing,
- [Internet Archive Wayback Machine](https://archive.org/web/) snapshot lookup
for broken links,
- tagging, pinning, linking, and full integration with other `nb` features.
Page information is
downloaded,
cleaned up,
structured,
and saved
into normal Markdown documents made for humans,
so bookmarks are easy to view and edit just like any other note.
`nb` uses [Git](https://git-scm.com/) in the background to
automatically record changes and sync notebooks with remote repositories.
`nb` can also be configured to
sync notebooks using a general purpose syncing utility like Dropbox
so notes can be edited in other apps on any device.
`nb` is designed to be portable, future-focused, and vendor independent,
providing a full-featured and intuitive experience within
a highly composable multimodal user-centric text interface.
The entire program is contained within
a single [well-tested](#tests) shell script
that can be
installed, copied, or `curl`ed almost anywhere and just work,
using a strategy inspired by
[progressive enhancement](https://en.wikipedia.org/wiki/Progressive_enhancement)
for various experience improvements in more capable environments.
`nb` works great whether you have one notebook with just a few notes
or dozens of notebooks containing thousands of notes, bookmarks, and other items.
`nb` makes it easy to incorporate other tools, writing apps, and workflows.
`nb` can be used a little, a lot, once in a while, or for just a subset of features.
`nb` is flexible.
📝
🔖
🔍
🌍
🔒
✅
🔄
🎨
📚
📌
📂
🌄
nb
### Installation
#### Dependencies
##### Required
- [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell))
- `nb` works perfectly with Zsh, fish, and any other shell
set as your primary login shell,
the system just needs to have Bash available on it.
- [Git](https://git-scm.com/)
- A text editor with command line support, such as:
- [Vim](https://en.wikipedia.org/wiki/Vim_\(text_editor\)),
- [Emacs](https://en.wikipedia.org/wiki/Emacs),
- [Visual Studio Code](https://code.visualstudio.com/),
- [Sublime Text](https://www.sublimetext.com/),
- [Helix](https://helix-editor.com/),
- [micro](https://github.com/zyedidia/micro),
- [nano](https://en.wikipedia.org/wiki/GNU_nano),
- [Atom](https://atom.io/),
- [TextMate](https://macromates.com/),
- [MacDown](https://macdown.uranusjr.com/),
- [some of these](https://github.com/topics/text-editor),
- [and many of these.](https://en.wikipedia.org/wiki/List_of_text_editors)
##### Optional
`nb` leverages standard command line tools
and works in standard Linux / Unix environments.
`nb` also checks the environment for some additional optional tools and
uses them to enhance the experience whenever they are available.
Recommended:
- [`bat`](https://github.com/sharkdp/bat)
- [`ncat`](https://nmap.org/ncat/) or [`socat`](https://www.kali.org/tools/socat/)
- [`pandoc`](https://pandoc.org/)
- [`rg`](https://github.com/BurntSushi/ripgrep)
- [`tig`](https://github.com/jonas/tig)
- [`w3m`](https://en.wikipedia.org/wiki/W3m)
Also supported for various enhancements:
[Ack](https://beyondgrep.com/),
[`afplay`](https://ss64.com/osx/afplay.html),
[`asciidoctor`](https://asciidoctor.org/),
[The Silver Searcher (`ag`)](https://github.com/ggreer/the_silver_searcher),
[`catimg`](https://github.com/posva/catimg),
[Chafa](https://github.com/hpjansson/chafa),
[Chromium](https://www.chromium.org) / [Chrome](https://www.google.com/chrome/),
[`eza`](https://github.com/eza-community/eza),
[`ffplay`](https://ffmpeg.org/ffplay.html),
[ImageMagick](https://imagemagick.org/),
[`glow`](https://github.com/charmbracelet/glow),
[GnuPG](https://en.wikipedia.org/wiki/GNU_Privacy_Guard),
[`highlight`](http://www.andre-simon.de/doku/highlight/en/highlight.php),
[`imgcat`](https://www.iterm2.com/documentation-images.html),
[`joshuto`](https://github.com/kamiyaa/joshuto),
[kitty's `icat` kitten](https://sw.kovidgoyal.net/kitty/kittens/icat.html),
[`lowdown`](https://kristaps.bsd.lv/lowdown),
[`lsd`](https://github.com/lsd-rs/lsd),
[Links](https://en.wikipedia.org/wiki/Links_(web_browser)),
[Lynx](https://en.wikipedia.org/wiki/Lynx_(web_browser)),
[`mdcat`](https://github.com/swsnr/mdcat),
[`mdless`](https://github.com/ttscoff/mdless),
[`mdv`](https://github.com/axiros/terminal_markdown_viewer),
[Midnight Commander (`mc`)](https://en.wikipedia.org/wiki/Midnight_Commander),
[`mpg123`](https://en.wikipedia.org/wiki/Mpg123),
[MPlayer](https://en.wikipedia.org/wiki/MPlayer),
[`ncat`](https://nmap.org/ncat/),
[`netcat`](https://netcat.sourceforge.net/),
[note-link-janitor](https://github.com/andymatuschak/note-link-janitor)
(via [plugin](https://github.com/xwmx/nb/blob/master/plugins/backlink.nb-plugin)),
[`pdftotext`](https://en.wikipedia.org/wiki/Pdftotext),
[Pygments](https://pygments.org/),
[Ranger](https://ranger.github.io/),
[readability-cli](https://gitlab.com/gardenappl/readability-cli),
[`rga` / ripgrep-all](https://github.com/phiresky/ripgrep-all),
[`sc-im`](https://github.com/andmarti1424/sc-im),
[`socat`](https://www.kali.org/tools/socat/),
[`termvisage`](https://github.com/AnonymouX47/termvisage),
[`termpdf.py`](https://github.com/dsanson/termpdf.py),
[Tidy-Viewer (`tv`)](https://github.com/alexhallam/tv),
[`timg`](https://github.com/hzeller/timg),
[vifm](https://vifm.info/),
[`viu`](https://github.com/atanunq/viu),
[VisiData](https://www.visidata.org/)
#### macOS / Homebrew
```bash
brew install xwmx/taps/nb
```
Installing `nb` with Homebrew also installs
the recommended dependencies above
and completion scripts for Bash, Zsh, and Fish.
Install the latest development version from the repository with:
```bash
brew install xwmx/taps/nb --head
```
`nb` is also available in
[homebrew-core](https://github.com/Homebrew/homebrew-core).
Installing it together with the `bash` formula is recommended:
```bash
brew install nb bash
```
#### Ubuntu, Windows, and others
##### npm
```bash
npm install -g nb.sh
```
After `npm` installation completes, run
`sudo "$(which nb)" completions install`
to install Bash and Zsh completion scripts (recommended).
On Ubuntu and WSL, you can
run [`sudo "$(which nb)" env install`](#env)
to install the optional dependencies.
When `nb` is installed on Windows,
`socat` ([MSYS](https://packages.msys2.org/package/socat),
[Cygwin](https://cygwin.com/packages/summary/socat.html)) is recommended.
*`nb` is also available under its original package name,
[notes.sh](https://www.npmjs.com/package/notes.sh),
which comes with an extra `notes` executable wrapping `nb`.*
##### Download and Install
To install as an administrator,
copy and paste one of the following multi-line commands:
```bash
# install using wget
sudo wget https://raw.github.com/xwmx/nb/master/nb -O /usr/local/bin/nb &&
sudo chmod +x /usr/local/bin/nb &&
sudo nb completions install
# install using curl
sudo curl -L https://raw.github.com/xwmx/nb/master/nb -o /usr/local/bin/nb &&
sudo chmod +x /usr/local/bin/nb &&
sudo nb completions install
```
On Ubuntu and WSL, you can
run [`sudo nb env install`](#env) to install the optional dependencies.
###### User-only Installation
To install with just user permissions, simply
add the `nb` script to your `$PATH`.
If you already have a `~/bin` directory, for example, you can
use one of the following commands:
```bash
# download with wget
wget https://raw.github.com/xwmx/nb/master/nb -O ~/bin/nb && chmod +x ~/bin/nb
# download with curl
curl -L https://raw.github.com/xwmx/nb/master/nb -o ~/bin/nb && chmod +x ~/bin/nb
```
Installing with just user permissions doesn't include
the optional dependencies or completions,
but `nb` core functionality works without them.
If you have `sudo` access and want
to install the completion scripts and dependencies, run the following command:
```bash
sudo nb env install
```
##### Make
To install with [Make](https://en.wikipedia.org/wiki/Make_(software)),
clone this repository, navigate to the clone's root directory, and run:
```bash
sudo make install
```
This will also install the completion scripts on all systems and
the recommended dependencies on Ubuntu and WSL.
##### bpkg
To install with [bpkg](https://github.com/bpkg/bpkg):
```bash
bpkg install xwmx/nb
```
##### basher
To install with [basher](https://www.basher.it/):
```bash
basher install xwmx/nb
```
#### Tab Completion
Bash, Fish, and Zsh tab completion should be enabled
when `nb` is installed using the methods above,
assuming you have the appropriate system permissions or installed with `sudo`.
If completion isn't working after installing `nb`, see the
[completion installation instructions](https://github.com/xwmx/nb/tree/master/etc).
#### Updating
When `nb` is installed using a package manager like npm or Homebrew,
use the package manager's upgrade functionality to update `nb` to
the latest version.
When installed via other methods,
`nb` can be updated to the latest version using
the [`nb update`](#update) subcommand.
## Overview
📝 Notes ·
Adding ·
Listing ·
Editing ·
Viewing ·
Deleting ·
🔖 Bookmarks ·
✅ Todos ·
✔️ Tasks ·
🏷 Tagging ·
🔗 Linking ·
🌍 Browsing ·
🌄 Images ·
🗂 Zettelkasten ·
📂 Folders ·
📌 Pinning ·
🔍 Search ·
↔ Moving & Renaming ·
🗒 History ·
📚 Notebooks ·
🔄 Git Sync ·
↕️ Import / Export ·
⚙️set&settings ·
🎨 Color Themes ·
🔌 Plugins ·
:/ Selectors ·
01 Metadata ·
❯ Shell ·
Shortcuts ·
? Help ·
$ Variables ·
Specifications ·
Tests
To get started, simply run:
```bash
nb
```
`nb` sets up your initial `home` notebook the first time it runs.
By default, notebooks and notes are global (at `~/.nb`),
so they are always available to `nb`
regardless of the current working directory.
`nb` also supports [local notebooks](#global-and-local-notebooks).
### 📝 Notes
#### Adding
↑ ·
nb add,
nb browse add
Use [`nb add`](#add) (shortcuts: [`nb a`](#add), [`nb +`](#add))
to create new notes:
```bash
# create a new note in your text editor
nb add
# create a new note with the filename "example.md"
nb add example.md
# create a new note containing "This is a note."
nb add "This is a note."
# create a new note with piped content
echo "Note content." | nb add
# create a new password-protected, encrypted note titled "Secret Document"
nb add --title "Secret Document" --encrypt
# create a new note in the notebook named "example"
nb example:add "This is a note."
# create a new note in the folder named "sample"
nb add sample/
```
[`nb add`](#add) with no arguments or input will open the new, blank note
in your environment's preferred text editor.
You can change your editor using
the `$EDITOR` environment variable
or [`nb set editor`](#editor).
`nb` files are [Markdown](https://daringfireball.net/projects/markdown/)
files by default. The default file type can be changed to
whatever you like
using [`nb set default_extension`](#default_extension).
[`nb add`](#add) has intelligent argument parsing
and behaves differently depending on the types of arguments it receives.
When a filename with extension is specified,
a new note with that filename is opened in the editor:
```bash
nb add example.md
```
When a string is specified, a new note is immediately created
with that string as the content and without opening the editor:
```bash
❯ nb add "This is a note."
Added: [1] 20200101000000.md
```
[`nb add `](#add) is useful for quickly jotting down notes directly
via the command line. Quoting content is optional, but recommended.
When no filename is specified, [`nb add`](#add) uses the current datetime as
the filename.
[`nb add`](#add) can also receive piped content, which behaves the same as
[`nb add `](#add):
```bash
# create a new note containing "Note content."
❯ echo "Note content." | nb add
Added: [6] 20200101000100.md
# create a new note containing the clipboard contents on macOS
❯ pbpaste | nb add
Added: [7] 20200101000200.md
# create a new note containing the clipboard contents using xclip
❯ xclip -o | nb add
Added: [8] 20200101000300.md
```
Content can be passed with the [`--content `](#add) option,
which also creates a new note without opening the editor:
```bash
nb add --content "Note content."
```
When content is piped,
specified with [`--content `](#add),
or passed as a string argument,
use the [`--edit`](#add) flag to open the file in the editor
before the change is committed.
The title, filename, and content can also be specified with long and
short options:
```bash
❯ nb add --filename "example.md" -t "Example Title" -c "Example content."
Added: [9] example.md "Example Title"
```
The [`-t `](#add) / [`--title `](#add) option also
sets the filename to the title,
lowercased with spaces and non-filename characters replaced with underscores:
```bash
❯ nb add --title "Example Title" "Example content."
Added: [10] example_title.md "Example Title"
```
Tags can be added with the [`--tags ,...`](#add) option, which
takes a comma separated list of tags,
converts them to [#hashtags](#-tagging),
and inserts them between the title and content:
```bash
❯ nb add "Example content." --title "Tagged Example" --tags tag1,tag2
Added: [11] tagged_example.md "Tagged Example"
❯ nb show 11 --print
# Tagged Example
#tag1 #tag2
Example content.
```
[Search](#-search) for tagged items with
[`nb search`](#search) / [`nb q`](#search):
```bash
# search for items tagged with "#tag1"
nb search --tag tag1
# search for items tagged with "#tag1" AND "#tag2", short options
nb q -t tag1 -t tag2
# search for items tagged with "#tag1" OR "#tag2", arguments
nb q \#tag1 --or \#tag2
```
Files can be created with any file type by specifying the extension either
in the filename (`example.md`),
the extension by itself (`.md`),
or via the [`--type `](#add) option (`--type md`):
```bash
# open a new Org file in the editor
nb add example.org
# open a new reStructuredText file in the editor
nb add --type rst
# open a new JavaScript file in the editor
nb add .js
```
Combining a type argument with piped clipboard content provides
a very convenient way to save code snippets using a clipboard utility such as
`pbpaste`,
`xclip`,
or [`pb`](https://github.com/xwmx/pb):
```bash
# save the clipboard contents as a JavaScript file in the current notebook
pb | nb add .js
# save the clipboard contents as a Rust file in the "rust" notebook
# using the shortcut alias `nb a`
pb | nb a rust: .rs
# save the clipboard contents as a Haskell file named "example.hs" in the
# "snippets" notebook using the shortcut alias `nb +`
pb | nb + snippets: example.hs
```
Use [`nb show`](#show) and [`nb browse`](#browse) to view code snippets
with automatic syntax highlighting and
use [`nb edit`](#edit) to open in your editor.
The [`clip` plugin](#clip) can also be used to
create notes from clipboard content.
Piping,
[`--title `](#add),
[`--tags `](#add),
[`--content `](#add),
and content passed in an argument
can be combined as needed
to create notes with content from multiple input methods and sources
using a single command:
```bash
❯ pb | nb add "Argument content." \
--title "Sample Title" \
--tags tag1,tag2 \
--content "Option content."
Added: [12] sample_title.md "Sample Title"
❯ nb show 12 --print
# Sample Title
#tag1 #tag2
Argument content.
Option content.
Clipboard content.
```
For a full list of options available for [`nb add`](#add), run
[`nb help add`](#add).
##### Password-Protected Encrypted Notes and Bookmarks
Password-protected notes and [bookmarks](#-bookmarks) are
created with the [`-e`](#add) / [`--encrypt`](#add) flag and
encrypted with AES-256 using OpenSSL by default.
GPG is also supported and can be configured with
[`nb set encryption_tool`](#encryption_tool).
Each protected note and bookmark is
encrypted individually with its own password.
When an encrypted item is viewed, edited, or opened,
`nb` will simply prompt for the item's password before proceeding.
After an item is edited,
`nb` automatically re-encrypts it and saves the new version.
Encrypted notes can be decrypted
using the OpenSSL and GPG command line tools directly, so
you aren't dependent on `nb` to decrypt your files.
##### Templates
Create a note based on a template by assigning a template string
or path to a template file with [`add --template `](#add):
```bash
# create a new note based on a template specified by path
nb add --template /path/to/example/template
# create a new note based on a template defined as a string
nb add --template "{{title}} • {{content}}"
```
`nb` template tags are enclosed in double curly brackets.
Supported tags include:
{{title}}- The note title, as specified with
add --title <title> {{tags}}- A list of hashtags, as specified with
add --tags <tag1>,<tag2> {{content}}- The note content, as specified with
add <content>,
add --content <content>,
and piped content. {{date}}- The ouput of the system's
datecommand. Use the
date
command options to control formatting, e.g.,
{{date +"%Y-%m-%d"}}.
An example complete markdown template could look like the following:
```
# {{title}}
{{date +"%Y-%m-%d"}}
{{tags}}
{{content}}
```
Templates are Bash strings processed with `eval`, so you can use
command substitution (`$(echo "Example command")`) to include
the output from command line tools and shell code.
A default template can be configured by assigning a string or path
to the [`$NB_DEFAULT_TEMPLATE`](#nb_default_template) variable
in your `~/.nbrc` file:
```bash
# set the default template to a path
export NB_DEFAULT_TEMPLATE="/path/to/example/template"
# set the default template with a string
export NB_DEFAULT_TEMPLATE="{{title}} • {{content}}"
```
Use [`nb add --no-template`](#add) to skip using a template when
one is assigned.
##### Shortcut Aliases: `nb a`, `nb +`
`nb` includes shortcuts for many commands, including
[`nb a`](#add) and [`nb +`](#add) for [`nb add`](#add):
```bash
# create a new note in your text editor
nb a
# create a new note with the filename "example.md"
nb a example.md
# create a new note containing "This is a note."
nb + "This is a note."
# create a new note containing the clipboard contents with xclip
xclip -o | nb +
# create a new note in the notebook named "example"
nb example:a
```
##### Other Aliases: `nb create`, `nb new`
[`nb add`](#add) can also be invoked with
[`nb create`](#add) and [`nb new`](#add) for convenience:
```bash
# create a new note containing "Example note content."
nb new "Example note content."
# create a new note with the title "Example Note Title"
nb create --title "Example Note Title"
```
##### Adding with `nb browse`
Items can also be added within terminal and GUI web browsers using
[`nb browse add`](#browse) / [`nb b a`](#browse):
```bash
❯ nb browse add
❯nb · home : +
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[add]
```
Pass a filename, relative path, and / or notebook name to
create a new note at that location:
```bash
# open the add form in the browser to create the file "file.md" in the folder "example"
nb browse add "example/file.md"
```
[`nb browse add`](#browse) includes options for quickly
pre-populating new notes with content:
```bash
❯ nb browse add --title "Example Title" --content "Example content." --tags tag1,tag2
❯nb · home : +
[# Example Title ]
[ ]
[#tag1 #tag2 ]
[ ]
[Example content. ]
[ ]
[ ]
[ ]
[ ]
[ ]
[add]
```
[`nb browse add`](#browse) can also be opened with
[`nb add --browse`](#add) / [`nb a -b`](#add).
For more information, see [Browsing](#-browsing).
#### Listing & Filtering
To list notes and notebooks, run [`nb ls`](#ls) (shortcut alias: `nb`):
Notebooks are listed above the line,
with the current notebook highlighted and/or underlined,
depending on terminal capabilities.
[`nb ls`](#ls) also includes a footer with example commands for easy reference.
The notebook header and command footer can be configured or hidden with
[`nb set header`](#header) and
[`nb set footer`](#footer).
```bash
❯ nb ls
home
----
[3] example.md · "Example content."
[2] sample.md · "Sample content."
[1] demo.md · "- Demo list item one."
```
Notes from the current notebook are listed in the order they were last modified.
By default, each note is listed with its
id, filename, and an excerpt from the first line of the note.
When a note has a title, the title is displayed
instead of the filename and first line.
Markdown titles can be defined within a note using
[either Markdown `h1` style](https://daringfireball.net/projects/markdown/syntax#header)
or [YAML front matter](#front-matter):
```markdown
# Example Title
```
```markdown
Sample Title
============
```
```markdown
---
title: Demo Title
---
```
[Org](https://orgmode.org/),
[LaTeX](https://www.latex-project.org/),
and [AsciiDoc](https://asciidoc.org/)
titles are recognized in `.org`,`.latex`, and `.asciidoc` / `.adoc` files:
```text
#+title: Example Org Title
```
```latex
\title{Example LaTeX Title}
```
```asciidoc
= Example AsciiDoc Title
```
Once defined, titles are displayed in place of the filename and first line
in the output of [`nb ls`](#ls):
```bash
❯ nb ls
home
----
[3] Example Title
[2] Sample Title
[1] Demo Title
```
Pass an id, filename, or title to view the listing for that note:
```bash
❯ nb ls Sample\ Title
[2] Sample Title
❯ nb ls 3
[3] Example Title
```
If there is no exact match, `nb` will list items with
titles and filenames that fuzzy match the query:
```bash
❯ nb ls exa
[3] Example Title
❯ nb ls ample
[3] Example Title
[2] Sample Title
```
Multiple words act like an `OR` filter, listing any
titles or filenames that match any of the words:
```bash
❯ nb ls example demo
[3] Example Title
[1] Demo Title
```
When multiple words are quoted, filter titles and filenames for that phrase:
```bash
❯ nb ls "example title"
[3] Example Title
```
For full text search, see [Search](#-search).
To view excerpts of notes, use the [`--excerpt`](#ls) or [`-e`](#ls) option,
which optionally accepts a length:
```bash
❯ nb ls 3 --excerpt
[3] Example Title
-----------------
# Example Title
This is an example excerpt.
❯ nb ls 3 -e 8
[3] Example Title
-----------------
# Example Title
This is an example excerpt.
More example content:
- one
- two
```
Several classes of file types are represented with emoji
[indicators](#indicators) to make them easily identifiable in lists.
For example, bookmarks and encrypted notes are listed with `🔖` and `🔒`:
```bash
❯ nb ls
home
----
[4] Example Note
[3] 🔒 encrypted-note.md.enc
[2] 🔖 Example Bookmark (example.com)
[1] 🔖 🔒 encrypted.bookmark.md.enc
```
File types include:
```text
🔉 Audio
📖 Book
🔖 Bookmark
🔒 Encrypted
📂 Folder
🌄 Image
📄 PDF, Word, or Open Office document
📹 Video
```
By default, items are listed starting with the most recently modified.
To reverse the order, use the [`-r`](#ls) or [`--reverse`](#ls) flag:
```bash
❯ nb ls
home
----
[2] Todos
[3] Example Title
[1] Ideas
❯ nb ls --reverse
[1] Ideas
[3] Example Title
[2] Todos
```
Notes can be sorted with the [`-s`](#ls) / [`--sort`](#ls) flag,
which can be combined with [`-r`](#ls) / [`--reverse`](#ls):
```bash
❯ nb ls
home
----
[2] Sample Title
[3] Example Title
[1] Demo Title
❯ nb ls --sort
[1] Demo Title
[2] Sample Title
[3] Example Title
❯ nb ls --sort --reverse
[3] Example Title
[2] Sample Title
[1] Demo Title
```
`nb` with no subcommand behaves like an alias for [`nb ls`](#ls),
so the examples above can be run without the `ls`:
```bash
❯ nb
home
----
[2] Sample Title
[3] Example Title
[1] Demo Title
❯ nb example
[3] Example Title
❯ nb 3 --excerpt
[3] Example Title
-----------------
# Example Title
This is an example excerpt.
❯ nb 3 -e 8
[3] Example Title
-----------------
# Example Title
This is an example excerpt.
More example content:
- one
- two
❯ nb --sort
[1] Demo Title
[2] Sample Title
[3] Example Title
❯ nb --sort --reverse
[3] Example Title
[2] Sample Title
[1] Demo Title
```
Short options can be combined for brevity:
```bash
# equivalent to `nb --sort --reverse --excerpt 2` and `nb -s -r -e 2`:
❯ nb -sre 2
[3] Example Title
-----------------
# Example Title
[2] Sample Title
----------------
Sample Title
============
[1] Demo Title
--------------
---
title: Demo Title
```
`nb` and [`nb ls`](#ls) display the 15 most recently modified items.
The default limit can be changed with [`nb set limit `](#limit).
To list a different number of items on a per-command basis, use the
[`-n `](#ls),
[`--limit `](#ls),
[`--`](#ls),
[`-a`](#ls),
and [`--all`](#ls)
flags:
```bash
❯ nb -n 1
home
----
[5] Example Five
4 omitted. 5 total.
❯ nb --limit 2
home
----
[5] Example Five
[4] Example Four
3 omitted. 5 total.
❯ nb --3
home
----
[5] Example Five
[4] Example Four
[3] Example Three
2 omitted. 5 total.
❯ nb --all
home
----
[5] Example Five
[4] Example Four
[3] Example Three
[2] Example Two
[1] Example One
```
Lists can be paginated with
[`-p `](#ls) / [`--page `](#ls),
which paginates by the value of [`nb set limit`](#limit) by
default, or the value of
[`-n `](#ls),
[`--limit `](#ls),
or [`--`](#ls)
when present:
```bash
❯ nb
home
----
[6] Example Six
[5] Example Five
[4] Example Four
[3] Example Three
[2] Example Two
[1] Example One
❯ nb set limit 3
NB_LIMIT set to 3
❯ nb --page 1
[6] Example Six
[5] Example Five
[4] Example Four
❯ nb -p 2
[3] Example Three
[2] Example Two
[1] Example One
❯ nb -p 2 --limit 2
[4] Example Four
[3] Example Three
❯ nb -p 3 --2
[2] Example Two
[1] Example One
```
List [#tagged](#tagging) items by passing `\#escaped` or `"#quoted"` hashtags
or tags specified with the [`--tags`](#ls) option. Multiple tags perform an
`AND` query:
```bash
# list items in the current notebook tagged with "#tag1", escaped
nb \#tag1
# list items in the "example" notebook tagged with "#tag2", quoted
nb example: "#tag2"
# list items in all notebooks tagged with "#tag1", long option
nb \#tag1 --all
# list items in the current notebook tagged with "#tag1" AND "#tag2"
nb \#tag1 "#tag2"
# list items in all notebooks tagged with "#tag2" AND "#tag3", short option
nb --tags tag2,tag3 -a
```
[`nb ls`](#ls) is a combination of
[`nb notebooks`](#notebooks) and [`nb list`](#list)
in one view and accepts the same arguments as [`nb list`](#list),
which lists only notes without the notebook list and with no limit by default:
```bash
❯ nb list
[100] Example One Hundred
[99] Example Ninety-Nine
[98] Example Ninety-Eight
... lists all notes ...
[2] Example Two
[1] Example One
```
For more information about options for listing notes, run
[`nb help ls`](#ls)
and
[`nb help list`](#list).
##### Listing with `browse`
Items can be listed within terminal and GUI web browsers using
[`nb browse`](#browse) / [`nb b`](#browse):
```bash
❯ nb browse example:sample/demo/
❯nb · example : sample / demo / +
search: [ ]
[example:sample/demo/7] Title Seven
[example:sample/demo/6] Title Six
[example:sample/demo/5] Title Five
[example:sample/demo/4] Title Four
[example:sample/demo/3] Title Three
next ❯
```
For more information, see [Browsing](#-browsing).
#### Editing
You can edit an item in your editor with
[`nb edit`](#edit) (shortcut: [`nb e`](#edit)):
```bash
# edit note by id
nb edit 3
# edit note by filename
nb edit example.md
# edit note by title
nb edit "A Document Title"
# edit note 12 in the notebook named "example"
nb edit example:12
# edit note 12 in the notebook named "example", alternative
nb example:12 edit
# edit note 12 in the notebook named "example", alternative
nb example:edit 12
```
[`edit`](#edit) and other subcommands that take an identifier
can be called with the identifier and subcommand name reversed:
```bash
# edit note by id
nb 3 edit
```
[`nb edit`](#edit) can also receive piped content, which it
appends to the specified note without opening the editor:
```bash
echo "Content to append." | nb edit 1
```
Content can be passed with the [`--content `](#edit) option,
which also appends the content without opening the editor:
```bash
nb edit 1 --content "Content to append."
```
Use the [`--overwrite`](#edit) option to overwrite existing file content
and the [`--prepend`](#edit) option to prepend the new content before existing content.
When content is piped or specified with [`--content `](#edit),
use the [`--edit`](#edit) flag to open the file in the editor
before the change is committed.
##### Editing Encrypted Notes
When a note is encrypted,
[`nb edit`](#edit) prompts you for the note password,
opens the unencrypted content in your editor,
and then automatically reencrypts the note when you are done editing.
##### Shortcut Alias: `nb e`
[`nb edit`](#edit) can be called by the shortcut alias, [`nb e`](#edit):
```bash
# edit note by id
nb e 3
# edit note by filename
nb e example.md
# edit note by title
nb e "A Document Title"
# edit note by id, alternative
nb 3 e
# edit note 12 in the notebook named "example"
nb e example:12
# edit note 12 in the notebook named "example", alternative
nb example:12 e
# edit note 12 in the notebook named "example", alternative
nb example:e 12
```
For [`nb edit`](#edit) help information, run [`nb help edit`](#edit).
##### Editing with `browse`
Items can be edited within terminal and GUI web browsers using
[`nb browse edit`](#browse) / [`nb b e`](#browse):
```bash
❯ nb browse edit text:formats/markdown/123
❯nb · text : formats / markdown / 123 · ↓ · editing · - | +
[# Daring Fireball: Markdown (daringfireball.net) ]
[ ]
[ ]
[ ]
[## Related ]
[ ]
[- ]
[ ]
[## Comments ]
[ ]
[See also: ]
[ ]
[- [[text:formats/org]] ]
[- [[cli:apps/nb]] ]
[ ]
[## Tags ]
[ ]
[save] · last: 2021-01-01 01:00:00
```
For more information, see
[`browse edit`](#browse-edit) and [Browsing](#-browsing).
#### Viewing
↑ ·
nb show,
nb browse,
nb open,
nb peek
Notes and other items can be viewed using
[`nb show`](#show) (shortcut: [`nb s`](#show)):
```bash
# show note by id
nb show 3
# show note by filename
nb show example.md
# show note by title
nb show "A Document Title"
# show note by id, alternative
nb 3 show
# show note 12 in the notebook named "example"
nb show example:12
# show note 12 in the notebook named "example", alternative
nb example:12 show
# show note 12 in the notebook named "example", alternative
nb example:show 12
```
By default, [`nb show`](#show) opens notes in
[`less`](https://linux.die.net/man/1/less),
with syntax highlighting if
[`bat`](https://github.com/sharkdp/bat),
[`highlight`](http://www.andre-simon.de/doku/highlight/en/highlight.php),
or
[Pygments](https://pygments.org/)
is installed.
You can navigate in `less` using the following keys:
```text
Key Function
--- --------
mouse scroll Scroll up or down
arrow up or down Scroll one line up or down
f Jump forward one window
b Jump back one window
d Jump down one half window
u Jump up one half window
/ Search for
n Jump to next match
q Quit
```
*If `less` scrolling isn't working in [iTerm2](https://www.iterm2.com/),
go to*
"Settings"
-> "Advanced"
-> "Scroll wheel sends arrow keys when in alternate screen mode"
*and change it to* "Yes".
*[More Info](https://stackoverflow.com/a/37610820)*
Use the [`-p`](#show) / [`--print`](#show) option
to print to standard output with syntax highlighting:
```bash
❯ nb show 123 --print
# Example Title
Example content:
- one
- two
- three
```
Use [`nb show --print --no-color`](#show) to print without syntax highlighting.
When [Pandoc](https://pandoc.org/) is available,
use the [`-r`](#show) / [`--render`](#show) option to
render the note to HTML and open it in your terminal browser:
```bash
nb show example.md --render
# opens example.md as an HTML page in w3m, links, or lynx
```
[`nb show`](#show) also supports previewing other file types in the terminal,
depending on the tools available in the environment. To prefer specific tools
for certain file types, `nb` provides configuration variables that can be
set in your `~/.nbrc` file,
which can be opened in your editor with [`nb settings edit`](#settings).
Supported file types and tools include:
- Markdown files ([`$NB_MARKDOWN_TOOL`](#nb_markdown_tool)):
- [`bat`](https://github.com/sharkdp/bat)
- [`glow`](https://github.com/charmbracelet/glow)
- [`lowdown`](https://kristaps.bsd.lv/lowdown)
- [`mdcat`](https://github.com/swsnr/mdcat)
- [`mdless`](https://github.com/ttscoff/mdless)
- [`mdv`](https://github.com/axiros/terminal_markdown_viewer)
- PDF files:
- [`termpdf.py`](https://github.com/dsanson/termpdf.py)
with [kitty](https://sw.kovidgoyal.net/kitty/)
- [`pdftotext`](https://en.wikipedia.org/wiki/Pdftotext)
- Audio files ([`$NB_AUDIO_TOOL`](#nb_audio_tool)):
- [`mplayer`](https://en.wikipedia.org/wiki/MPlayer)
- [`afplay`](https://ss64.com/osx/afplay.html)
- [`mpg123`](https://en.wikipedia.org/wiki/Mpg123)
- [`ffplay`](https://ffmpeg.org/ffplay.html)
- [Images](#-images) ([`$NB_IMAGE_TOOL`](#nb_image_tool)):
- [`catimg`](https://github.com/posva/catimg)
- [Chafa](https://github.com/hpjansson/chafa)
- [ImageMagick](https://imagemagick.org/) with a terminal that
supports [sixels](https://en.wikipedia.org/wiki/Sixel)
- [`imgcat`](https://www.iterm2.com/documentation-images.html) with
[iTerm2](https://www.iterm2.com/)
- [kitty's `icat` kitten](https://sw.kovidgoyal.net/kitty/kittens/icat.html)
- [`termvisage`](https://github.com/AnonymouX47/termvisage)
- [`timg`](https://github.com/hzeller/timg)
- [`viu`](https://github.com/atanunq/viu)
- Folders, Directories, Notebooks ([`$NB_DIRECTORY_TOOL`](#nb_directory_tool)):
- [`eza`](https://github.com/eza-community/eza)
- [`joshuto`](https://github.com/kamiyaa/joshuto)
- [`lsd`](https://github.com/lsd-rs/lsd)
- [Midnight Commander (`mc`)](https://en.wikipedia.org/wiki/Midnight_Commander)
- [`ranger`](https://ranger.github.io/)
- [`vifm`](https://vifm.info/)
- Word Documents:
- [Pandoc](https://pandoc.org/) with
[`w3m`](https://en.wikipedia.org/wiki/W3m) or
[`links`](https://en.wikipedia.org/wiki/Links_(web_browser))
- Excel, CSV, TSV, and data files ([`$NB_DATA_TOOL`](#nb_data_tool)):
- [VisiData](https://www.visidata.org/)
- [`sc-im`](https://github.com/andmarti1424/sc-im)
- [Tidy-Viewer (`tv`)](https://github.com/alexhallam/tv)
- EPUB ebooks:
- [Pandoc](https://pandoc.org/) with
[`w3m`](https://en.wikipedia.org/wiki/W3m) or
[`links`](https://en.wikipedia.org/wiki/Links_(web_browser))
When using [`nb show`](#show) with other file types or
if the above tools are not available,
[`nb show`](#show) opens files in
your system's preferred application for each type.
[`nb show`](#show) also provides [options](#show) for
querying information about an item. For example, use the
[`--added`](#show) / [`-a`](#show) and [`--updated`](#show) / [`-u`](#show)
flags to print the date and time that an item was added or updated:
```bash
❯ nb show 2 --added
2020-01-01 01:01:00 -0700
❯ nb show 2 --updated
2020-02-02 02:02:00 -0700
```
[`nb show`](#show) is primarily intended for viewing items within the terminal.
To view a file in the system's preferred GUI application, use
[`nb open`](#open).
To [browse](#-browsing) rendered items in terminal and GUI web browsers, use
[`nb browse`](#browse).
For full [`nb show`](#show) usage information, run [`nb help show`](#show).
##### Shortcut Alias: `nb s`
[`nb show`](#show) can be called using the shortcut alias [`nb s`](#show):
```bash
# show note by id
nb s 3
# show note by filename
nb s example.md
# show note by title
nb s "A Document Title"
# show note by id, alternative
nb 3 s
# show note 12 in the notebook named "example"
nb s example:12
# show note 12 in the notebook named "example", alternative
nb example:12 s
# show note 12 in the notebook named "example", alternative
nb example:s 12
```
##### Alias: `nb view`
[`nb show`](#show) can also be invoked with [`nb view`](#show) for convenience:
```bash
# show note by id
nb view 3
# show note by filename
nb view example.md
# show note by title
nb view "A Document Title"
# show note by id, alternative
nb 3 view
```
##### Viewing with `browse`
Items can be viewed within terminal and GUI web browsers using
[`nb browse`](#browse) / [`nb b`](#browse):
```bash
❯ nb browse text:formats/markdown/123
❯nb · text : formats / markdown / 123 · ↓ · edit | +
Daring Fireball: Markdown (daringfireball.net)
https://daringfireball.net/projects/markdown/
Related
• https://en.wikipedia.org/wiki/Markdown
Comments
See also:
• [[text:formats/org]]
• [[cli:apps/nb]]
Tags
#markup #plain-text
Content
Daring Fireball: Markdown
Download
Markdown 1.0.1 (18 KB) — 17 Dec 2004
Introduction
Markdown is a text-to-HTML conversion tool for web writers. Markdown allows
you to write using an easy-to-read, easy-to-write plain text format, then
convert it to structurally valid XHTML (or HTML).
```
For more information, see [Browsing](#-browsing).
#### Deleting
↑ ·
nb delete,
nb browse delete
To delete one or more notes, pass any number of
ids, filenames, titles, and other [selectors](#-selectors)
to [`nb delete`](#delete) (shortcuts: [`nb d`](#delete), [`nb -`](#delete)):
```bash
# delete item by id
nb delete 3
# delete item by filename
nb delete example.md
# delete item by title
nb delete "A Document Title"
# delete item by id, alternative
nb 3 delete
# delete item 12 in the notebook named "example"
nb delete example:12
# delete item 12 in the notebook named "example", alternative
nb example:12 delete
# delete item 12 in the notebook named "example", alternative
nb example:delete 12
# delete item 345 in the folder named "example"
nb delete example/345
# delete items with the ids 89, 56, and 21
nb delete 89 56 21
```
By default, [`nb delete`](#delete) will display a confirmation prompt.
To skip, use the [`--force`](#delete) / [`-f`](#delete) option:
```bash
nb delete 3 --force
```
##### Shortcut Aliases: `nb d`, `nb -`
[`nb delete`](#delete) has the aliases [`nb d`](#delete) and [`nb -`](#delete):
```bash
# delete note by id
nb d 3
# delete note by filename
nb d example.md
# delete note by title
nb - "A Document Title"
# delete note by id, alternative
nb 3 d
# delete note 12 in the notebook named "example"
nb - example:12
# delete note 12 in the notebook named "example", alternative
nb example:12 d
# delete note 12 in the notebook named "example", alternative
nb example:d 12
```
For [`nb delete`](#delete) help information, run [`nb help delete`](#delete).
##### Deleting with `nb browse`
Items can be deleted within terminal and GUI web browsers using
[`nb browse delete`](#browse) / [`nb b d`](#browse):
```bash
❯ nb browse delete example:4
❯nb · example : 4 · ↓ · edit · - | +
deleting
[4] example_file.md "Example Title"
[delete]
```
For more information, see [Browsing](#-browsing).
### 🔖 Bookmarks
↑ ·
nb <url>,
nb browse,
nb bookmark,
nb open,
nb peek,
nb show
`nb` includes a bookmarking system to conveniently
create, annotate, view, search, [browse](#-browsing), and manage
collections of bookmarks.
Bookmarks in `nb` are stored as
[simple structured Markdown files](#nb-markdown-bookmark-file-format)
containing information extracted from the bookmarked pages.
To create a new bookmark, pass a URL as the first argument to `nb`:
```bash
nb https://example.com
```
`nb` automatically generates a bookmark using information from the page:
```markdown
# Example Title (example.com)
## Description
Example description.
## Content
Example Title
=============
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
[More information\...](https://www.iana.org/domains/example)
```
`nb` embeds the page content in the bookmark, making it available for
[full text search](#-search) with [`nb search`](#search) and
locally-served, distraction-free [reading and browsing](#-browsing)
with [`nb browse`](#browse).
When [Pandoc](https://pandoc.org/) is installed,
the HTML page content is converted to Markdown.
When [readability-cli](https://gitlab.com/gardenappl/readability-cli)
is installed, markup is cleaned up to focus on content. When
[Chromium](https://www.chromium.org) or
[Chrome](https://www.google.com/chrome/) is installed,
JavaScript-dependent pages are rendered and the resulting markup is
saved.
Many shells automatically escape special characters in URLs. If a
URL contains characters that are preventing it from being saved in full,
URLs can also be enclosed in quotes when passed to `nb`:
```bash
nb "https://example.com#sample-anchor"
```
In addition to caching the page content,
you can also include a quote from the page in a
[`## Quote`](#-quote) section
using the
[`-q `](#bookmark) / [`--quote `](#bookmark) option:
```bash
nb https://example.com --quote "Example quote line one.
Example quote line two."
```
```markdown
# Example Title (example.com)
## Description
Example description.
## Quote
> Example quote line one.
>
> Example quote line two.
## Content
Example Title
=============
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
[More information\...](https://www.iana.org/domains/example)
```
Add a comment in a [`## Comment`](#-comment) section using the
[`-c `](#bookmark) / [`--comment `](#bookmark) option:
```bash
nb https://example.com --comment "Example comment."
```
```markdown
# Example Title (example.com)
## Description
Example description.
## Comment
Example comment.
## Content
Example Title
=============
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
[More information\...](https://www.iana.org/domains/example)
```
Add related URLs and [linked](#-linking) [selectors](#-selectors)
to a [`## Related`](#-related) section using the
[`-r ( | )`](#bookmark) /
[`--related ( | )`](#bookmark)
option:
```bash
nb https://example.com --related example:123 -r https://example.net
```
```markdown
# Example Title (example.com)
## Description
Example description.
## Related
- [[example:123]]
-
## Content
Example Title
=============
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
[More information\...](https://www.iana.org/domains/example)
```
Bookmarks can be tagged using the
[`-t ,...`](#bookmark) /
[`--tags ,...`](#bookmark) option.
Tags are converted into [#hashtags](#-tagging) and
added to a [`## Tags`](#-tags) section:
```bash
nb https://example.com --tags tag1,tag2
```
```markdown
# Example Title (example.com)
## Description
Example description.
## Tags
#tag1 #tag2
## Content
Example Title
=============
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
[More information\...](https://www.iana.org/domains/example)
```
[Search](#-search) for tagged bookmarks with
[`nb search`](#search) / [`nb q`](#search):
```bash
nb search --tag tag1
nb q -t tag1
nb q \#tag1
```
[`nb search`](#search) / [`nb q`](#search)
automatically searches archived page content:
```bash
❯ nb q "example query"
[10] 🔖 example.bookmark.md "Example Bookmark (example.com)"
------------------------------------------------------------
5:Lorem ipsum example query.
```
Bookmarks can also be encrypted:
```bash
# create a new password-protected, encrypted bookmark
nb https://example.com --encrypt
```
Encrypted bookmarks require a password before they can be viewed or
opened.
Multiple URLs can be bookmarked with a single command by passing
multiple [``](#bookmark) arguments. Additional arguments will be reused
for each bookmark:
```bash
❯ nb https://example.com https://example.net --tags tag1,tag2 --filename example
Added: [1] 🔖 example.bookmark.md "Example Domain (example.com)"
Added: [2] 🔖 example-1.bookmark.md "Example Domain (example.net)"
```
#### Listing and Filtering Bookmarks
Bookmarks are included in
`nb`,
[`nb ls`](#ls),
[`nb list`](#list),
and [`nb browse`](#browse)
along with items of other types.
[`nb bookmark`](#bookmark) and [`nb bookmark list`](#bookmark) can be used to
list and filter only bookmarks:
```bash
❯ nb bookmark
Add: nb Help: nb help bookmark
------------------------------------
[3] 🔖 🔒 example.bookmark.md.enc
[2] 🔖 Bookmark Two (example.com)
[1] 🔖 Bookmark One (example.com)
❯ nb bookmark list two
[2] 🔖 Bookmark Two (example.com)
```
Bookmarks are also included in `nb`, [`nb ls`](#ls), and [`nb list`](#list):
```bash
❯ nb
home
----
[7] 🔖 Bookmark Three (example.com)
[6] Example Note
[5] 🔖 Bookmark Two (example.net)
[4] Sample Note
[3] 🔖 🔒 example-encrypted.bookmark.md.enc
[2] Demo Note
[1] 🔖 Bookmark One (example.com)
```
Use the [`--type `](#ls) / [`--`](#ls)
option as a filter to display only bookmarks:
```bash
❯ nb --type bookmark
[7] 🔖 Bookmark Three (example.com)
[5] 🔖 Bookmark Two (example.net)
[3] 🔖 🔒 example-encrypted.bookmark.md.enc
[1] 🔖 Bookmark One (example.com)
❯ nb --bookmark
[7] 🔖 Bookmark Three (example.com)
[5] 🔖 Bookmark Two (example.net)
[3] 🔖 🔒 example-encrypted.bookmark.md.enc
[1] 🔖 Bookmark One (example.com)
```
`nb` saves the domain in the title, making it easy to filter by domain
using any list subcommands:
```bash
❯ nb example.com
[7] 🔖 Bookmark Three (example.com)
[1] 🔖 Bookmark One (example.com)
```
For more listing options, see
[`nb help ls`](#ls),
[`nb help list`](#list),
and [`nb help bookmark`](#bookmark).
##### Shortcut Aliases: `nb bk`, `nb bm`
[`nb bookmark`](#bookmark) can also be used with the aliases
[`nb bk`](#bookmark) and [`nb bm`](#bookmark):
```bash
❯ nb bk
Add: nb Help: nb help bookmark
------------------------------------
[7] 🔖 Bookmark Three (example.com)
[5] 🔖 Bookmark Two (example.net)
[3] 🔖 🔒 example-encrypted.bookmark.md.enc
[1] 🔖 Bookmark One (example.com)
❯ nb bm example.net
[5] 🔖 Bookmark Two (example.net)
```
#### Viewing Bookmarks
↑ ·
nb browse,
nb open,
nb peek,
nb show
`nb` provides multiple ways to view bookmark files, bookmarked content,
and bookmarked URLs.
Use [`nb browse`](#browse) (shortcut: [`nb b`](#browse))
to [browse](#-browsing) bookmarks with cached content,
[[wiki-style links]],
linked [#tags](#-tagging), and external links:
```bash
❯ nb browse text:formats/markdown/123
❯nb · text : formats / markdown / 123 · ↓ · edit | +
Daring Fireball: Markdown (daringfireball.net)
https://daringfireball.net/projects/markdown/
Related
• https://en.wikipedia.org/wiki/Markdown
Comments
See also:
• [[text:formats/org]]
• [[cli:apps/nb]]
Tags
#markup #plain-text
Content
Daring Fireball: Markdown
Download
Markdown 1.0.1 (18 KB) — 17 Dec 2004
Introduction
Markdown is a text-to-HTML conversion tool for web writers. Markdown allows
you to write using an easy-to-read, easy-to-write plain text format, then
convert it to structurally valid XHTML (or HTML).
```
For more information, see [Browsing](#-browsing).
[`nb open`](#open) (shortcut: [`nb o`](#open)) opens the bookmarked URL in
your system's primary web browser:
```bash
# open bookmark by id
nb open 3
# open bookmark 12 in the notebook named "example"
nb open example:12
# open bookmark 12 in the notebook named "example", alternative
nb example:12 open
# open bookmark 12 in the notebook named "example", alternative
nb example:open 12
```
*N.B. To use [`nb open`](#open) with
[WSL](https://docs.microsoft.com/en-us/windows/wsl/install),
install [wslu](https://github.com/wslutilities/wslu).*
[`nb peek`](#peek) (shortcut: [`nb p`](#peek), alias: [`nb preview`](#peek))
opens the bookmarked URL in your terminal web browser,
such as
[w3m](https://en.wikipedia.org/wiki/W3m),
[Links](https://en.wikipedia.org/wiki/Links_(web_browser)), or
[Lynx](https://en.wikipedia.org/wiki/Lynx_(web_browser)):
```bash
# peek bookmark by id
nb peek 3
# peek bookmark 12 in the notebook named "example"
nb peek example:12
# peek bookmark 12 in the notebook named "example", alternative
nb example:12 peek
# peek bookmark 12 in the notebook named "example", alternative
nb example:peek 12
```
[`nb open`](#open) and [`nb peek`](#peek)
work seamlessly with encrypted bookmarks.
`nb` simply prompts you for the bookmark's password.
[`nb open`](#open) and [`nb peek`](#peek)
automatically check whether the URL is still valid.
If the page has been removed, `nb` can check
the [Internet Archive Wayback Machine](https://archive.org/web/)
for an archived copy.
The preferred terminal web browser can be set using
the `$BROWSER` environment variable,
assigned in `~/.bashrc`, `~/.zshrc`, or similar:
```bash
export BROWSER=lynx
```
When `$BROWSER` is not set, `nb` looks for
[`w3m`](https://en.wikipedia.org/wiki/W3m),
[`links`](https://en.wikipedia.org/wiki/Links_(web_browser)), and
[`lynx`](https://en.wikipedia.org/wiki/Lynx_(web_browser))
and uses the first one it finds.
`$BROWSER` can also be used to easy specify the terminal browser for
an individual command:
```bash
❯ BROWSER=links nb 12 peek
# opens the URL from bookmark 12 in links
❯ BROWSER=w3m nb 12 peek
# opens the URL from bookmark 12 in w3m
```
[`nb show`](#show) and [`nb edit`](#edit)
can also be used to view and edit bookmark files,
which include the cached page converted to Markdown.
[`nb show --render`](#show) / [`nb show -r`](#show)
displays the bookmark file converted to HTML in the terminal web browser,
including all bookmark fields and the cached page content,
providing a cleaned-up, distraction-free, locally-served view of
the page content along with all of your notes.
##### Shortcut Aliases: `nb o` and `nb p`
[`nb open`](#open) and [`nb peek`](#peek)
can also be used with the shortcut aliases
[`nb o`](#open) and [`nb p`](#peek):
```bash
# open bookmark by id
nb o 3
# open bookmark 12 in the notebook named "example"
nb o example:12
# open bookmark 12 in the notebook named "example", alternative
nb example:12 o
# peek bookmark by id
nb p 3
# peek bookmark 12 in the notebook named "example"
nb p example:12
# peek bookmark 12 in the notebook named "example", alternative
nb example:12 p
```
#### Bookmark File Format
Bookmarks are identified by a `.bookmark.md` file extension.
The bookmark URL is the first URL in the file within `<` and `>` characters.
To create a minimally valid bookmark file with [`nb add`](#add):
```bash
nb add example.bookmark.md --content ""
```
For a full overview, see
[`nb` Markdown Bookmark File Format](#nb-markdown-bookmark-file-format).
#### `bookmark` -- A command line tool for managing bookmarks.
`nb` includes [`bookmark`](#bookmark-help), a full-featured
command line interface for creating, viewing, searching, and editing bookmarks.
[`bookmark`](#bookmark-help) is a shortcut for the
[`nb bookmark`](#bookmark) subcommand,
accepting all of the same subcommands and options with identical behavior.
Bookmark a page:
```bash
❯ bookmark https://example.com --tags tag1,tag2
Added: [3] 🔖 20200101000000.bookmark.md "Example Title (example.com)"
```
List and filter bookmarks with
[`bookmark`](#bookmark) and [`bookmark list`](#bookmark):
```bash
❯ bookmark
Add: bookmark Help: bookmark help
---------------------------------------
[3] 🔖 🔒 example.bookmark.md.enc
[2] 🔖 Example Two (example.com)
[1] 🔖 Example One (example.com)
❯ bookmark list two
[2] 🔖 Example Two (example.com)
```
View a bookmark in your terminal web browser:
```bash
bookmark peek 2
```
Open a bookmark in your system's primary web browser:
```bash
bookmark open 2
```
Perform a full text search of bookmarks and archived page content:
```bash
❯ bookmark search "example query"
[10] 🔖 example.bookmark.md "Example Bookmark (example.com)"
------------------------------------------------------------
5:Lorem ipsum example query.
```
See [`bookmark help`](#bookmark-help) for more information.
### ✅ Todos
↑ ·
nb do,
nb tasks,
nb todo,
nb undo
Use [`nb todo`](#todo) (shortcut: [`nb to`](#todo))
to create, list, and update todos.
`nb` todos are [structured Markdown documents](#nb-markdown-todo-file-format)
referencing a single primary todo,
with optional [tasks](#%EF%B8%8F-tasks).
Use [`nb todo add`](#todo) to create a new todo:
```bash
# create a new todo titled "Example todo one."
❯ nb todo add "Example todo one."
Added: [1] ✔️ [ ] Example todo one.
❯ nb show 1 --print
# [ ] Example todo one.
```
Use the [`--due `](#todo) option to add an optional due date in a
[`## Due`](#-due) section:
```bash
# create a new todo titled "Example todo two." with a due date of "2100-01-01"
❯ nb todo add "Example todo two." --due "2100-01-01"
Added: [2] ✔️ [ ] Example todo two.
❯ nb show 2 --print
# [ ] Example todo two.
## Due
2100-01-01
```
Add an optional [description](#-description-1) with the
[`--description `](#todo)
option:
```bash
❯ nb todo add "Example todo three." --description "Example description."
Added: [3] ✔️ [ ] Example todo three.
❯ nb show 3 --print
# [ ] Example todo three.
## Description
Example description.
```
Todos can have [tasks](#%EF%B8%8F-tasks).
Tasks added with one or more [`--task `](#todo) options
are represented as a markdown task list and placed in a
[`## Tasks`](#-tasks) section:
```bash
❯ nb todo add "Example todo seven." --task "Task one." --task "Task two." --task "Task three."
Added: [7] ✔️ [ ] Example todo seven.
❯ nb show 7 --print
# [ ] Example todo seven.
## Tasks
- [ ] Task one.
- [ ] Task two.
- [ ] Task three.
```
Related URLs and [linked](#-linking) [selectors](#-selectors)
can be added to a [`## Related`](#-related-1) field using the
[`-r ( | )`](#todo) / [`--related ( | )`](#todo)
option:
```bash
❯ nb todo add "Example todo four." --related example:123 -r https://example.com
Added: [4] ✔️ [ ] Example todo four.
❯ nb show 4 --print
# [ ] Example todo four.
## Related
- [[example:123]]
-
```
[Tags](#-tagging) can be added to todos with the
[`--tags ,...`](#todo) option:
```bash
❯ nb todo add "Example todo five." --tags tag1,tag2
Added: [5] ✔️ [ ] Example todo five.
❯ nb show 5 --print
# [ ] Example todo five.
## Tags
#tag1 #tag2
```
[Tags](#-tagging), [links](#-linking), and URLs can be
[browsed](#-browsing)
in terminal and GUI web browsers with [`nb browse`](#browse).
#### Listing Todos
List todos in with [`nb todos`](#todo):
```bash
# list todos in the current notebook
❯ nb todos
[6] ✔️ [ ] Example todo six.
[5] ✅ [x] Example todo five.
[4] ✔️ [ ] Example todo four.
[3] ✅ [x] Example todo three.
[2] ✅ [x] Example todo two.
[1] ✔️ [ ] Example todo one.
# list todos in the notebook named "sample"
❯ nb todos sample:
[sample:4] ✅ [x] Sample todo four.
[sample:3] ✔️ [ ] Sample todo three.
[sample:2] ✔️ [ ] Sample todo two.
[sample:1] ✅ [x] Sample todo one.
```
Open / undone todos can be listed with [`nb todos open`](#todo):
```bash
# list open todos in the current notebook
❯ nb todos open
[6] ✔️ [ ] Example todo six.
[4] ✔️ [ ] Example todo four.
[1] ✔️ [ ] Example todo one.
# list open todos in the notebook named "sample"
❯ nb tasks open sample:
[sample:3] ✔️ [ ] Sample todo three.
[sample:2] ✔️ [ ] Sample todo two.
```
Closed / done todos can be listed with [`nb todos closed`](#todo):
```bash
# list closed todos in the current notebook
❯ nb todos closed
[5] ✅ [x] Example todo five.
[3] ✅ [x] Example todo three.
[2] ✅ [x] Example todo two.
# list closed todos in the notebook named "sample"
❯ nb tasks closed sample:
[sample:4] ✅ [x] Sample todo four.
[sample:1] ✅ [x] Sample todo one.
```
See
[`nb help todo`](#todo)
for more information.
#### `do` / `undo`
Mark a todo as done or closed with [`nb do`](#do):
```bash
# add a new todo titled "Example todo six."
❯ nb todo add "Example todo six."
Added: [6] ✔️ [ ] Example todo six.
# mark todo 6 as done / closed
❯ nb do 6
Done: [6] ✅ [x] Example todo six.
```
Re-open a closed todo with [`nb undo`](#undo):
```bash
# mark todo 6 as undone / open
❯ nb undo 6
Undone: [6] ✔️ [ ] Example todo six.
```
See
[`nb help do`](#do)
and
[`nb help undo`](#undo)
for more information.
### ✔️ Tasks
↑ ·
nb do,
nb tasks,
nb todo,
nb undo
`nb` can list and update tasks in [todos](#-todos) and other Markdown documents.
Tasks are defined as one or more Markdown list items starting with
`- [ ]` to indicate an open task or `- [x]` to indicate a done / closed task:
```markdown
- [ ] Example open task.
- [x] Example closed task.
```
List tasks in items, folders, and notebooks with
[`nb tasks`](#tasks) (shortcut: [`nb t`](#tasks)),
which lists both tasks and todos:
```bash
# list tasks in item 7
❯ nb tasks 7
[7] ✔️ [ ] Example todo seven.
------------------------------
[7 1] [x] Task one.
[7 2] [x] Task two.
[7 3] [ ] Task three.
# list tasks and todos in the notebook named "example"
❯ nb tasks example:
[example:9] ✔️ [ ] Example todo nine.
[example:8] ✅ [x] Example todo eight.
--------------------------------------
[example:8 1] [x] Task one.
[example:8 2] [x] Task two.
[example:6] ✔️ [ ] Example todo six.
[example:4] Example Note Title
------------------------------
[example:4 1] [ ] Task one.
[example:4 2] [x] Task two.
[example:4 3] [ ] Task three.
[example:3] ✔️ [ ] Example todo three.
```
Open / undone tasks can be listed with [`nb tasks open`](#tasks):
```bash
# list open tasks in item 7
❯ nb tasks open 7
[7] ✔️ [ ] Example todo seven.
------------------------------
[7 3] [ ] Task three.
# list open tasks and todos in the notebook named "example"
❯ nb tasks open example:
[example:9] ✔️ [ ] Example todo nine.
[example:6] ✔️ [ ] Example todo six.
[example:4] Example Note Title
------------------------------
[example:4 1] [ ] Task one.
[example:4 3] [ ] Task three.
[example:3] ✔️ [ ] Example todo three.
```
Closed / done tasks can be listed with [`nb tasks closed`](#tasks):
```bash
# list closed tasks in item 7
❯ nb tasks closed 7
[7] ✔️ [ ] Example todo seven.
------------------------------
[7 1] [x] Task one.
[7 2] [x] Task two.
# list closed tasks and todos in the notebook named "example"
❯ nb tasks closed example:
[example:8] ✅ [x] Example todo eight.
--------------------------------------
[example:8 1] [x] Task one.
[example:8 2] [x] Task two.
[example:4] Example Note Title
------------------------------
[example:4 2] [x] Task two.
```
Tasks are identified by the item [selector](#-selectors), followed by
a space, then followed by the sequential number of the task in the file.
Use [`nb do`](#do) to mark tasks as done / closed:
```bash
# list tasks in item 9
❯ nb tasks 9
[9] ✔️ [ ] Example todo nine.
-----------------------------
[9 1] [ ] Task one.
[9 2] [ ] Task two.
[9 3] [ ] Task three.
# mark task 2 in item 9 as done / closed
❯ nb do 9 2
[9] ✔️ [ ] Example todo nine.
-----------------------------
Done: [9 2] [x] Task two.
# list tasks in item 9
❯ nb tasks 9
[9] ✔️ [ ] Example todo nine.
-----------------------------
[9 1] [ ] Task one.
[9 2] [x] Task two.
[9 3] [ ] Task three.
```
Undo a done / closed task with [`nb undo`](#undo):
```bash
# mark task 2 in item 9 as undone / open
❯ nb undo 9 2
[9] ✔️ [ ] Example todo nine.
-----------------------------
Undone: [9 2] [ ] Task two.
# list tasks in item 9
❯ nb tasks 9
[9] ✔️ [ ] Example todo nine.
-----------------------------
[9 1] [ ] Task one.
[9 2] [ ] Task two.
[9 3] [ ] Task three.
```
See
[`nb help tasks`](#tasks)
for more information.
### 🏷 #tagging
↑ ·
nb add,
nb bookmark,
nb browse,
nb list,
nb ls,
nb search
`nb` recognizes `#hashtags` defined anywhere within a document.
A hashtag is defined in `nb` as a `#` character followed by any number of
letters, numbers, underscores, and dashes.
Notes and bookmarks can be tagged when they are created using the
`--tags ,...` option,
which is available with
[`nb add`](#add),
[`nb `](#nb-help),
[`nb browse add`](#browse),
[`nb bookmark`](#bookmark),
and
[`nb todo`](#todo).
`--tags` takes a comma-separated list of tags, converts them to
`#hashtags`,
and adds them to the document.
Tags added to notes with [`nb add --tags`](#add) are placed between the title
and body text:
```bash
❯ nb add --title "Example Title" "Example note content." --tags tag1,tag2
```
```markdown
# Example Title
#tag1 #tag2
Example note content.
```
Tags added to [bookmarks](#bookmarks) with
[`nb --tags`](#nb-help) and [`nb bookmark --tags`](#bookmark)
are placed in a [`## Tags`](#-tags) section:
```bash
❯ nb https://example.com --tags tag1,tag2
```
```markdown
# Example Title (example.com)
## Description
Example description.
## Tags
#tag1 #tag2
## Content
Example Title
=============
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
[More information\...](https://www.iana.org/domains/example)
```
Tags added to [todos](#-todos) with
[`nb todo add --tags`](#todo)
are placed in a [`## Tags`](#-tags-1) section:
```bash
❯ nb todo add --tags tag1,tag2 "Example todo."
```
```markdown
# [ ] Example todo.
## Tags
#tag1 #tag2
```
Use [`nb --tags`](#nb-help), [`nb ls --tags`](#ls),
and [`nb list --tags`](#list)
to list the tags present in a notebook, folder, or item:
```bash
# list all tags found in items in the current notebook
nb --tags
# list all tags found in the folder named "example"
nb example/ --tags
# list all tags in the item with id 123 in the notebook named "sample"
nb sample:123 --tags
```
List tagged items by passing `\#escaped` or `"#quoted"` hashtags or tags
specified with the [`--tags`](#ls) option to [`nb`](#ls) / [`nb ls`](#ls):
```bash
# list items in the current notebook tagged with "#tag1", escaped
nb \#tag1
# list items in the "example" notebook tagged with "#tag2", quoted
nb example: "#tag2"
# list items in all notebooks tagged with "#tag3", long option
nb --tags tag3 --all
# list items in all notebooks tagged with "#tag3", short option
nb --tags tag3 -a
```
Combine multiple tags to search for items containing all specified tags:
```bash
# list items in the current notebook tagged with "#tag1" AND "#tag2"
nb \#tag1 "#tag2"
# list items in the current notebook tagged with "#tag2" AND "#tag3"
nb --tags tag2,tag3
# list items in all notebooks tagged with "#tag1" AND "#tag2" AND "#tag3" AND "#tag4"
nb \#tag1 "#tag2" --tags tag3,tag4 --all
```
Tagged items can be [searched](#-search) with
[`nb search`](#search) / [`nb q`](#search):
```bash
# search for items tagged with "#tag1"
nb search --tag tag1
# search for items tagged with "#tag1", shortcut and short option
nb q -t tag1
# search for items tagged with "#tag1", shortcut and argument
nb q \#tag1
# search for items tagged with "#tag1", shortcut and argument, alternative
nb q "#tag1"
# search for items tagged with "#tag1" AND "#tag2"
nb q --tag tag1 --tag tag2
# search for items tagged with "#tag1" AND "#tag2", short options
nb q -t tag1 -t tag2
# search for items tagged with "#tag1" AND "#tag2", arguments
nb q \#tag1 \#tag2
# search for items tagged with "#tag1" AND "#tag2", tag list
nb q --tags tag1,tag2
# search for items tagged with either "#tag1" OR "#tag2", options
nb q -t tag1 --or -t tag2
# search for items tagged with either "#tag1" OR "#tag2", arguments
nb q \#tag1 --or \#tag2
# search for items tagged with either "#tag1" OR "#tag2", single argument
nb q "#tag1|#tag2"
# search for items tagged with "#tag1" AND "#tag2" AND "#tag3"
nb q -t tag1 --tags tag2,tag3
# search for items tagged with "#tag1" OR "#tag2" OR "#tag3"
nb q -t tag1 --or --tags tag2,tag3
# search for items tagged with "#tag1" OR "#tag2" OR "#tag3"
nb q \#tag1 --or -t tag2 --or "#tag3"
```
Linked tags can be [browsed](#-browsing) with [`nb browse`](#browse),
providing another dimension of browsability in terminal and GUI web browsers,
complimenting [[wiki-style linking]].
Tags in notes,
bookmarks,
files in text-based formats,
Word `.docx` documents,
and [Open Document](https://en.wikipedia.org/wiki/OpenDocument) `.odt` files
are rendered as links to the list of items in the notebook sharing that tag:
```bash
❯nb · example : 321
Example Title
#tag1 #tag2
Example content with link to [[Sample Title]].
More example content:
- one
- two
- three
```
Use the [`-t `](#browse) / [`--tag `](#browse) option
to open [`nb browse`](#browse) to the list of
all items in the current notebook or a specified notebook or folder that
share a tag:
```bash
# open to a list of items tagged with "#tag2" in the "example" notebook
❯ nb browse example: --tag tag2
❯nb · example
search: [#tag2 ]
[example:321] Example Title
[example:654] Sample Title
[example:789] Demo Title
# shortcut alias and short option
❯ nb b example: -t tag2
❯nb · example
search: [#tag2 ]
[example:321] Example Title
[example:654] Sample Title
[example:789] Demo Title
```
For more information about full-text search, see
[Search](#-search) and [`nb search`](#search).
For more information about browsing, see
[Browsing](#-browsing) and [`nb browse`](#browse).
### 🔗 Linking
Notes,
bookmarks,
files in text-based formats,
Word `.docx` documents,
and [Open Document](https://en.wikipedia.org/wiki/OpenDocument) `.odt` files
can reference other items using
[[wiki-style links]],
making `nb` a powerful terminal-first platform for
[Zettelkasten](#-zettelkasten),
wiki-style knowledge mapping,
and other link-based note-taking methods.
To add a link from a note or bookmark to another in the same notebook,
include the id, title, or relative path for the target item
within double square brackets anywhere in the linking document:
```bash
# link to the item with id 123 in the root level of current notebook
[[123]]
# link to the item titled "Example Title" in the root level of the current notebook
[[Example Title]]
# link to the item with id 456 in the folder named "Sample Folder"
[[Sample Folder/456]]
# link to the item titled "Demo Title" in the folder named "Sample Folder"
[[Sample Folder/Demo Title]]
```
To link to an item in another notebook,
add the notebook name with a colon before the identifier:
```bash
# link to the item with id 123 in the "sample" folder in the "example" notebook
[[example:sample/123]]
# link to the item titled "Example Title" in the "demo" notebook
[[demo:Example Title]]
# link to the item with filename "Example File.md" in the "sample" notebook
[[sample:Example File.md]]
```
The text for a link can be specified after a pipe `|` character:
```bash
# render link to item 123 in the "example" notebook as [[Example Link Text]]
[[example:123|Example Link Text]]
```
[[wiki-style links]] cooperate well with
[Org links](https://orgmode.org/guide/Hyperlinks.html),
which have a similar syntax,
providing a convenient option for linking collections of Org files.
Linked items can be [browsed](#-browsing) with [`nb browse`](#browse).
For more information about identifying items, see [Selectors](#-selectors).
### 🌍 Browsing
Use [`nb browse`](#browse) (shortcut: [`nb b`](#browse)) to
browse, view, edit, and search linked notes, bookmarks, notebooks, folders,
and other items using terminal and GUI web browsers.
[`nb browse`](#browse) includes an embedded, terminal-first web application
that renders
[[wiki-style links]]
and
[#hashtags](#-tagging)
as internal links, enabling you to browse your notes and notebooks in web
browsers, including seamlessly browsing to and from the offsite links in
bookmarks and notes.
```bash
❯ nb browse
❯nb · home : +
search: [ ]
[home:6] 📌 Example Markdown Title
[home:12] 🔒 example-encrypted.md.enc
[home:11] 🔖 Example Bookmark (example.com)
[home:10] 🔖 🔒 example-encrypted.bookmark.md.enc
[home:9] Example .org Title
[home:8] 🌄 example-image.png
[home:7] 📄 example.pdf
[home:5] 🔉 example-audio.mp3
[home:4] Example LaTeX Title
[home:3] 📹 example-video.mp4
[home:2] example.md
[home:1] 📂 Example Folder
```
Lists are displayed using the same format as `nb` and [`nb ls`](#ls),
including [pinned](#-pinning) items, with each list item linked.
Lists are automatically paginated to fit the height of the terminal window.
```bash
❯ nb browse example:sample/demo/
❯nb · example : sample / demo / +
search: [ ]
[example:sample/demo/7] Title Seven
[example:sample/demo/6] Title Six
[example:sample/demo/5] Title Five
[example:sample/demo/4] Title Four
[example:sample/demo/3] Title Three
next ❯
```
[`nb browse`](#browse) is designed to make it easy to navigate within
terminal web browsers using only keyboard commands,
while also supporting mouse interactions.
The [`nb browse`](#browse) interface includes links
to quickly jump to parent folders,
the current notebook,
and other notebooks.
[`nb browse`](#browse) opens in
[w3m](https://en.wikipedia.org/wiki/W3m),
[Links](https://en.wikipedia.org/wiki/Links_\(web_browser\)),
or in the browser set in the `$BROWSER` environment variable.
Use [`nb browse --gui`](#browse) / [`nb b -g`](#browse) to
open in the system's primary [GUI web browser](#browse---gui).
To open a specific item in [`nb browse`](#browse),
pass the [selector](#-selectors) for the item, folder, or notebook
to [`nb browse`](#browse):
```bash
# open the item with id 42 in the folder named "sample" in the "example" notebook
❯ nb browse example:sample/42
❯nb · example : sample / 42 · ↓ · edit | +
Example Title
#tag1 #tag2
Example content with link to [[Demo Title]].
More example content:
• one
• two
• three
```
Items can also be browsed with
[`nb show --browse`](#show) / [`nb s -b`](#show),
which behaves identically.
[`nb browse`](#browse) is particularly useful for [bookmarks](#-bookmarks).
Cached content is rendered in the web browser along with comments and notes.
Internal and external links are easily accessible directly in the terminal,
providing a convenient, distraction-free approach for browsing collections
of bookmarks.
```bash
❯ nb browse text:formats/markdown/123
❯nb · text : formats / markdown / 123 · ↓ · edit | +
Daring Fireball: Markdown (daringfireball.net)
https://daringfireball.net/projects/markdown/
Related
• https://en.wikipedia.org/wiki/Markdown
Comments
See also:
• [[text:formats/org]]
• [[cli:apps/nb]]
Tags
#markup #plain-text
Content
Daring Fireball: Markdown
Download
Markdown 1.0.1 (18 KB) — 17 Dec 2004
Introduction
Markdown is a text-to-HTML conversion tool for web writers. Markdown allows
you to write using an easy-to-read, easy-to-write plain text format, then
convert it to structurally valid XHTML (or HTML).
```
Notes, bookmarks, files in text-based formats, source code,
Word `.docx` documents, and
[Open Document](https://en.wikipedia.org/wiki/OpenDocument) `.odt`
files are converted into HTML and rendered in the browser. Use the down
arrow (`↓`) link to view or download the original file.
#### `browse edit`
Items in text formats can be edited within terminal and GUI web browsers using
the `edit` link on the item page or by opening the item with
[`nb browse edit`](#browse) / [`nb b e`](#browse),
which automatically resizes the form to fit the current terminal window:
```bash
❯ nb browse edit text:formats/markdown/123
❯nb · text : formats / markdown / 123 · ↓ · editing · - | +
[# Daring Fireball: Markdown (daringfireball.net) ]
[ ]
[ ]
[ ]
[## Related ]
[ ]
[- ]
[ ]
[## Comments ]
[ ]
[See also: ]
[ ]
[- [[text:formats/org]] ]
[- [[cli:apps/nb]] ]
[ ]
[## Tags ]
[ ]
[save] · last: 2021-01-01 01:00:00
```
Terminal web browsers provide different editing workflows.
[`w3m`](https://en.wikipedia.org/wiki/W3m) opens items in your `$EDITOR`,
then returns you back to the browser to save changes and continue browsing.
Edits in [`links`](https://en.wikipedia.org/wiki/Links_(web_browser))
are performed directly in the browser.
Syntax highlighting, block selection, and other
[advanced editor features](#browse---gui-editing)
are available with [`nb browse --gui`](#browse).
#### `browse add`
Add an item within the browser using the `+` link or
[`nb browse add`](#browse) / [`nb b a`](#browse).
Pass a notebook, folder, and / or filename selector to create a new note
in that location:
```bash
❯ nb browse add text:formats/
❯nb · text : formats / +
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[add]
```
[`nb browse add`](#browse) includes options for quickly pre-populating
new notes with content:
```bash
❯ nb browse add --title "Example Title" --content "Example content." --tags tag1,tag2
❯nb · home : +
[# Example Title ]
[ ]
[#tag1 #tag2 ]
[ ]
[Example content. ]
[ ]
[ ]
[ ]
[ ]
[ ]
[add]
```
#### `browse delete`
Use the `-` link on the [`nb browse edit`](#browse) page or
[`nb browse delete`](#browse) / [`nb b d`](#browse)
to delete an item:
```bash
❯ nb browse delete example:4
❯nb · example : 4 · ↓ · edit · - | +
deleting
[4] example_file.md "Example Title"
[delete]
```
#### `browse` Search
[`nb browse`](#browse) includes a search field powered by
[`nb search`](#search)
that can be used to search the current notebook or folder.
Search queries are treated as command line arguments for
[`nb search`](#search),
providing the ability to perform `AND` and `OR` queries.
Use the
[`-q `](#browse) / [`--query `](#browse)
option to open [`nb browse`](#browse) to
the results page for a search:
```bash
# open to a list of items containing "example" in the current notebook
❯ nb browse --query "example"
❯nb · home
search: [example ]
[home:321] Test Title
[home:654] Sample Title
[home:789] Demo Title
# using shortcut alias and short option
❯ nb b -q "example"
❯nb · home
search: [example ]
[home:321] Test Title
[home:654] Sample Title
[home:789] Demo Title
```
Search for [#tags](#-tagging) with the
[`-t`](#browse) / [`--tag`](#browse) / [`--tags`](#browse) options:
```bash
# open to a list of items tagged with "#tag2" in the current notebook
❯ nb browse --tag tag2
❯nb · home
search: [#tag2 ]
[home:654] Sample Title
[home:789] Demo Title
# using shortcut alias and short option
❯ nb b -t tag2
❯nb · home
search: [#tag2 ]
[home:654] Sample Title
[home:789] Demo Title
```
For more information about search options, see [Search](#-search) and
[`nb search`](#search).
#### `browse --gui`
To open any [`nb browse`](#browse) view in
the system's primary GUI web browser,
add the [`nb browse --gui`](#browse) / [`nb b -g`](#browse) option:
```bash
# open the item with id 123 in the "sample" notebook in the system's primary GUI browser
nb browse sample:123 --gui
# open the folder named "example" in the system's primary GUI browser,
# short option
nb browse example/ -g
# open the current notebook in the system's primary GUI browser,
# shortcut alias and short option
nb b -g
```
##### `browse --gui` Editing
By default,
[`nb browse --gui`](#browse)
uses the browser's default `` for editing items.
[Ace](https://ace.c9.io/) is a text editor for GUI web browsers
that provides advanced text editing functionality,
including block selection and
[syntax highlighting](#gui-web-syntax-highlighting).
To use Ace as the editor for [`nb browse --gui`](#browse),
add the following line to your `~/.nbrc` file:
```bash
export NB_ACE_ENABLED=1
```
The next time a form is loaded in [`nb browse`](#browse),
`nb` will automatically download
(from [GitHub](https://github.com/ajaxorg/ace-builds/)),
install,
and enable the Ace editor in
[`nb browse edit --gui`](#browse) and [`nb browse add --gui`](#browse).
#### `browse` Portability
[`nb browse`](#browse) depends on
either [`socat`](https://www.kali.org/tools/socat/)
or
[`ncat`](https://nmap.org/ncat/) (available as part of
the `ncat` or `nmap` package in most package managers) and
[`pandoc`](https://pandoc.org/). When neither `socat` nor `ncat` is
available and the Bash version is 5.2 or higher, [`nb browse`](#browse)
falls back to a pure Bash implementation that supports all features
except the Ace editor. When only `pandoc` is available,
the current note is rendered and
[[wiki-style links]]
go to unrendered, original files.
When `socat`,`ncat`, or Bash 5.2+ is available without `pandoc`,
files in plain text formats are rendered with the original markup unconverted.
If neither `ncat`, `socat`, Bash 5.2+, nor `pandoc` is available,
[`nb browse`](#browse) falls back to the default behavior of [`nb show`](#show).
When `nb` is installed on Windows,
`socat` ([MSYS](https://packages.msys2.org/package/socat),
[Cygwin](https://cygwin.com/packages/summary/socat.html)) is recommended.
#### `browse` Privacy
[`nb browse`](#browse) is completely local and self-contained within `nb`,
from the CSS and JavaScript
all the way down through the HTTP request parsing and response building,
with no imports, libraries, frameworks, or third-party code
outside of the few binary dependencies
(`bash`, `git`, `ncat` / `socat`, `pandoc`),
the Linux / Unix environment,
and the optional [Ace editor](#ace-editor).
Terminal web browsers don't use JavaScript, so visits from them are not
visible to some web analytics tools.
[`nb browse`](#browse) includes a number of additional features
to enhance privacy and avoid leaking information:
- Page content is cached locally within each bookmark file,
making it readable in terminal and GUI web browsers
without requesting the page again or needing to be connected to the internet.
- `` tags in bookmarked content are removed to avoid requests.
- Outbound links are automatically rewritten to use an
[exit page redirect](https://geekthis.net/post/hide-http-referer-headers/#exit-page-redirect)
to mitigate leaking information via the
[referer header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer).
- All pages include the `` tag.
- Links include a `rel="noopener noreferrer"` attribute.
- `lynx` is opened with the `-noreferer` option.
#### `browse` AsciiDoc
To [`browse`](#browse) items in [AsciiDoc](https://asciidoc.org/) format,
install [`asciidoctor`](https://asciidoctor.org/).
#### Shortcut Alias: `nb b`
[`nb browse`](#browse) can also be used with the alias [`nb b`](#browse):
```bash
# open the current notebook in the terminal web browser
nb b
# open the item with id 123 in the "example" notebook using the terminal web browser
nb b example:123
# open the notebook named "sample" in the GUI web browser
nb b sample: -g
```
For more information, see [`nb browse`](#browse).
### 🌄 Images
↑ ·
nb browse,
nb import,
nb open,
nb show
`nb` can be used to view, organize, browse, reference, and work with images in
terminals,
web browsers,
and GUI applications.
#### Image Items
[Import](#%EF%B8%8F-import--export) images with [`nb import`](#import):
```bash
# import the image file "example.png" into the current notebook
nb import example.png
# import an image file from a URL into the current notebook
nb import https://raw.githubusercontent.com/xwmx/nb/master/docs/images/nb.png
# nb import "sample.jpg" into the "demo" folder in the "example" notebook
nb import sample.jpg example:demo/
```
Imported images are displayed with [`🌄` indicators](#indicators) in
[lists](#listing--filtering):
```bash
❯ nb
home
----
[5] Example Five
[4] 🌄 example-image.png
[3] Example Three
[2] Example Two
[1] Example One
```
Imported image items can be opened in the system GUI application for
the item's file type using [`nb open`](#open):
```bash
# open the image "example-image.png" in the system GUI photo viewer
nb open example-image.png
# open the image with id "4" in the system GUI photo viewer
nb 4 o
```
Image items can be viewed in web browsers with [`nb browse`](#browse),
providing a convenient mechanism for
[browsing](#-browsing) notebooks and folders containing image collections.
[`nb browse`](#browse) renders image items within in an `` tag
on the item page. Open the item page for an image item by passing a
[selector](#-selectors) to [`nb browse`](#browse), optionally including the
[`-g`](#browse) / [`--gui`](#browse) option
to open the page in the system GUI web browser:
```bash
# open item with id "123" in the terminal web browser
nb browse 123
# open item with id "456" in the "example" notebook in the GUI web browser
nb browse example:456 --gui
# open item "example:456" in the GUI web browser, alternative
nb example:456 b -g
```
The original file can be viewed or downloaded from the item page
by either clicking the image item or using the down arrow (`↓`) link.
[`nb browse --gui`](#browse---gui) displays images in any GUI web browser.
Some terminal web browsers, such as [`w3m`](http://w3m.sourceforge.net/),
can be configured to display images.
[`nb show`](#show) can display images directly in the terminal with
supported tools and configurations, including:
- [`catimg`](https://github.com/posva/catimg)
- [Chafa](https://github.com/hpjansson/chafa)
- [ImageMagick](https://imagemagick.org/) with a terminal that
supports [sixels](https://en.wikipedia.org/wiki/Sixel)
- [`imgcat`](https://www.iterm2.com/documentation-images.html) with
[iTerm2](https://www.iterm2.com/)
- [kitty's `icat` kitten](https://sw.kovidgoyal.net/kitty/kittens/icat.html)
- [`termvisage`](https://github.com/AnonymouX47/termvisage)
- [`timg`](https://github.com/hzeller/timg)
- [`viu`](https://github.com/atanunq/viu)
A preferred image viewer tool can be set with the
[`$NB_IMAGE_TOOL`](#nb_image_tool) variable in your `~/.nbrc` file,
which can be opened in your editor with [`nb settings edit`](#settings).
#### Inline Images
Images can be referenced and rendered inline within
notes, bookmarks, and other items.
To reference an image in the same notebook,
specify the image's relative path within the notebook:
```markdown
# reference "example.jpg" from markdown

# reference "demo.png" in the "sample" folder from markdown

```
Images in any notebook can be referenced using the `--original` URL,
obtainable from the image's [`nb browse`](#browse) item page
by either clicking the image item or using the down arrow (`↓`) link.
```markdown
# reference "example.jpg" in the "home" notebook with the --original URL

```
Image references in content are rendered inline within web browsers with
[`nb browse`](#browse) and [`nb show --render`](#show).
`` tags are stripped from bookmarked content when rendering to HTML.
Inline images can still be used in other bookmark sections like
[`## Comment`](#-comment).
### 🗂 Zettelkasten
Zettelkasten (German: "slip box") is a method of note-taking and
personal knowledge management modeled around a few key features:
- Notes are taken liberally on index cards.
- Each note is numbered for easy reference.
- Index cards are organized into boxes.
- Index cards can reference other index cards.
- Cards can include tags and other metadata.
Since `nb` works directly on plain text files
organized in normal system directories in normal git repositories,
`nb` is a very close digital analogue to physical zettelkasten note-taking.
| Zettelkasten | `nb` |
|:-----------------:|:-----------------------------------------------:|
| index cards | [notes](#-notes) & [bookmarks](#-bookmarks) |
| numbering | ids & [selectors](#-selectors) |
| slip boxes | [notebooks](#-notebooks) |
| tags | [#tags](#-tagging) |
| metadata | [front matter](#front-matter) |
| cross-references | [[wiki-style links]] |
| fast note-taking | [`nb add`](#adding)/[`nb `](#-bookmarks) |
For more information about Zettelkasten, see
[Wikipedia](https://en.wikipedia.org/wiki/Zettelkasten).
### 📂 Folders
↑ ·
nb add,
nb browse,
nb folders,
nb list,
nb ls
Items can be organized in folders.
To add a note to a folder,
call [`nb add`](#add) with the folder's relative path within the notebook
followed by a slash:
```bash
# add a new note in the folder named "example"
nb add example/
# add a new note in the folder named "demo" in "example"
nb add example/demo/
```
`nb` automatically creates any intermediate folders as needed.
Folders can be created directly using [`nb add folder`](#add),
[`nb folders add`](#folders), and [`nb add --type folder`](#add):
```bash
# create a new folder named "sample"
nb add folder sample
# create a new folder named "sample", alternative
nb folders add sample
# create a new folder named "demo"
nb add demo --type folder
# create a folder named "example" containing a folder named "test"
nb add example/test --type folder
```
To list the items in a folder, pass the folder relative path to
`nb`,
[`nb ls`](#ls),
[`nb list`](#list),
or [`nb browse`](#browse)
with a trailing slash:
```bash
❯ nb example/demo/
home
----
[example/demo/3] Title Three
[example/demo/2] Title Two
[example/demo/1] Title One
```
Folders can also be identified by the folder'