Installations
npm install @crabas0npm/ex-animi-eius
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
20.12.2
NPM Version
10.5.0
Releases
Unable to fetch releases
Total Downloads
Cumulative downloads
Total Downloads
106
Last day
0%
2
Compared to previous day
Last week
0%
5
Compared to previous week
Last month
75%
7
Compared to previous month
Last year
0%
106
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
32
nb
is a command line and local web
note‑taking, bookmarking, archiving,
and knowledge base application
with:
- plain text data storage,
- encryption,
- filtering, pinning, #tagging, and search,
- Git-backed versioning and syncing,
- Pandoc-backed conversion,
- [[wiki-style linking]],
- terminal and GUI web browsing,
- inline images,
- todos with tasks,
- global and local notebooks,
- organization with folders,
- customizable color themes,
- extensibility through plugins,
and more, in a single portable script.
nb
creates notes in text-based formats like
Markdown,
Org,
LaTeX,
and AsciiDoc,
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 can be installed to enhance functionality,
but nb
works great without them.
nb
is also a powerful bookmarking system featuring:
- locally-served, text-centric, distraction-free bookmark 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 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 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 shell script
that can be
installed, copied, or curl
ed almost anywhere and just work,
using a strategy inspired by
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
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
- A text editor with command line support, such as:
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:
Also supported for various enhancements:
Ack,
afplay
,
asciidoctor
,
The Silver Searcher (ag
),
catimg
,
Chafa,
Chromium / Chrome,
eza
,
ffplay
,
ImageMagick,
glow
,
GnuPG,
highlight
,
imgcat
,
joshuto
,
kitty's icat
kitten,
lsd
,
Links,
Lynx,
mdcat
,
mdless
,
mdv
,
Midnight Commander (mc
),
mpg123
,
MPlayer,
ncat
,
netcat
,
note-link-janitor
(via plugin),
pdftotext
,
Pygments,
Ranger,
readability-cli,
rga
/ ripgrep-all,
sc-im
,
socat
,
termvisage
,
termpdf.py
,
Tidy-Viewer (tv
),
timg
,
vifm,
viu
,
VisiData
macOS / Homebrew
1brew 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:
1brew install xwmx/taps/nb --head
nb
is also available in
homebrew-core.
Installing it together with the bash
formula is recommended:
1brew install nb bash
Ubuntu, Windows, and others
npm
1npm install -g @crabas0npm/ex-animi-eius
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
to install the optional dependencies.
When nb
is installed on Windows,
socat
(MSYS,
Cygwin) is recommended.
nb
is also available under its original package name,
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:
1# install using wget 2sudo wget https://raw.github.com/crabas0npm/ex-animi-eius/master/nb -O /usr/local/bin/nb && 3 sudo chmod +x /usr/local/bin/nb && 4 sudo nb completions install 5 6# install using curl 7sudo curl -L https://raw.github.com/crabas0npm/ex-animi-eius/master/nb -o /usr/local/bin/nb && 8 sudo chmod +x /usr/local/bin/nb && 9 sudo nb completions install
On Ubuntu and WSL, you can
run sudo nb env install
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:
1# download with wget 2wget https://raw.github.com/crabas0npm/ex-animi-eius/master/nb -O ~/bin/nb && chmod +x ~/bin/nb 3 4# download with curl 5curl -L https://raw.github.com/crabas0npm/ex-animi-eius/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:
1sudo nb env install
Make
To install with Make, clone this repository, navigate to the clone's root directory, and run:
1sudo 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:
1bpkg install crabas0npm/ex-animi-eius
basher
To install with basher:
1basher install crabas0npm/ex-animi-eius
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.
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
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:
1nb
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.
📝 Notes
Adding
↑ ·
nb add
,
nb browse add
Use nb add
(shortcuts: nb a
, nb +
)
to create new notes:
1# create a new note in your text editor 2nb add 3 4# create a new note with the filename "example.md" 5nb add example.md 6 7# create a new note containing "This is a note." 8nb add "This is a note." 9 10# create a new note with piped content 11echo "Note content." | nb add 12 13# create a new password-protected, encrypted note titled "Secret Document" 14nb add --title "Secret Document" --encrypt 15 16# create a new note in the notebook named "example" 17nb example:add "This is a note." 18 19# create a new note in the folder named "sample" 20nb add sample/
nb 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
.
nb
files are Markdown
files by default. The default file type can be changed to
whatever you like
using nb set default_extension
.
nb 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:
1nb 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:
1❯ nb add "This is a note." 2Added: [1] 20200101000000.md
nb add <string>
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
uses the current datetime as
the filename.
nb add
can also receive piped content, which behaves the same as
nb add <string>
:
1# create a new note containing "Note content." 2❯ echo "Note content." | nb add 3Added: [6] 20200101000100.md 4 5# create a new note containing the clipboard contents on macOS 6❯ pbpaste | nb add 7Added: [7] 20200101000200.md 8 9# create a new note containing the clipboard contents using xclip 10❯ xclip -o | nb add 11Added: [8] 20200101000300.md
Content can be passed with the --content <content>
option,
which also creates a new note without opening the editor:
1nb add --content "Note content."
When content is piped,
specified with --content <content>
,
or passed as a string argument,
use the --edit
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:
1❯ nb add --filename "example.md" -t "Example Title" -c "Example content." 2Added: [9] example.md "Example Title"
The -t <title>
/ --title <title>
option also
sets the filename to the title,
lowercased with spaces and non-filename characters replaced with underscores:
1❯ nb add --title "Example Title" "Example content." 2Added: [10] example_title.md "Example Title"
Tags can be added with the --tags <tag1>,<tag2>...
option, which
takes a comma separated list of tags,
converts them to #hashtags,
and inserts them between the title and content:
1❯ nb add "Example content." --title "Tagged Example" --tags tag1,tag2 2Added: [11] tagged_example.md "Tagged Example" 3 4❯ nb show 11 --print 5# Tagged Example 6 7#tag1 #tag2 8 9Example content.
Search for tagged items with
nb search
/ nb q
:
1# search for items tagged with "#tag1" 2nb search --tag tag1 3 4# search for items tagged with "#tag1" AND "#tag2", short options 5nb q -t tag1 -t tag2 6 7# search for items tagged with "#tag1" OR "#tag2", arguments 8nb 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 <type>
option (--type md
):
1# open a new Org file in the editor 2nb add example.org 3 4# open a new reStructuredText file in the editor 5nb add --type rst 6 7# open a new JavaScript file in the editor 8nb 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
:
1# save the clipboard contents as a JavaScript file in the current notebook 2pb | nb add .js 3 4# save the clipboard contents as a Rust file in the "rust" notebook 5# using the shortcut alias `nb a` 6pb | nb a rust: .rs 7 8# save the clipboard contents as a Haskell file named "example.hs" in the 9# "snippets" notebook using the shortcut alias `nb +` 10pb | nb + snippets: example.hs
Use nb show
and nb browse
to view code snippets
with automatic syntax highlighting and
use nb edit
to open in your editor.
The clip
plugin can also be used to
create notes from clipboard content.
Piping,
--title <title>
,
--tags <tag-list>
,
--content <content>
,
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:
1❯ pb | nb add "Argument content." \ 2 --title "Sample Title" \ 3 --tags tag1,tag2 \ 4 --content "Option content." 5Added: [12] sample_title.md "Sample Title" 6 7❯ nb show 12 --print 8# Sample Title 9 10#tag1 #tag2 11 12Argument content. 13 14Option content. 15 16Clipboard content.
For a full list of options available for nb add
, run
nb help add
.
Password-Protected Encrypted Notes and Bookmarks
Password-protected notes and bookmarks are
created with the -e
/ --encrypt
flag and
encrypted with AES-256 using OpenSSL by default.
GPG is also supported and can be configured with
nb set 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.
Shortcut Aliases: nb a
, nb +
nb
includes shortcuts for many commands, including
nb a
and nb +
for nb add
:
1# create a new note in your text editor 2nb a 3 4# create a new note with the filename "example.md" 5nb a example.md 6 7# create a new note containing "This is a note." 8nb + "This is a note." 9 10# create a new note containing the clipboard contents with xclip 11xclip -o | nb + 12 13# create a new note in the notebook named "example" 14nb example:a
Other Aliases: nb create
, nb new
nb add
can also be invoked with
nb create
and nb new
for convenience:
1# create a new note containing "Example note content." 2nb new "Example note content." 3 4# create a new note with the title "Example Note Title" 5nb create --title "Example Note Title"
Adding with nb browse
Items can also be added within terminal and GUI web browsers using
nb browse add
/ nb b a
:
1❯ nb browse add 2❯nb · home : + 3 4[ ] 5[ ] 6[ ] 7[ ] 8[ ] 9[ ] 10[ ] 11[ ] 12[ ] 13[ ] 14 15[add]
Pass a filename, relative path, and / or notebook name to create a new note at that location:
1# open the add form in the browser to create the file "file.md" in the folder "example" 2nb browse add "example/file.md"
nb browse add
includes options for quickly
pre-populating new notes with content:
1❯ nb browse add --title "Example Title" --content "Example content." --tags tag1,tag2 2❯nb · home : + 3 4[# Example Title ] 5[ ] 6[#tag1 #tag2 ] 7[ ] 8[Example content. ] 9[ ] 10[ ] 11[ ] 12[ ] 13[ ] 14 15[add]
nb browse add
can also be opened with
nb add --browse
/ nb a -b
.
For more information, see Browsing.
Listing & Filtering
To list notes and notebooks, run nb ls
(shortcut alias: nb
):
Notebooks are listed above the line,
with the current notebook highlighted and/or underlined,
depending on terminal capabilities.
nb 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
and
nb set footer
.
1❯ nb ls 2home 3---- 4[3] example.md · "Example content." 5[2] sample.md · "Sample content." 6[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
or YAML front matter:
1# Example Title
1Sample Title 2============
1--- 2title: Demo Title 3---
Org,
LaTeX,
and AsciiDoc
titles are recognized in .org
,.latex
, and .asciidoc
/ .adoc
files:
1#+title: Example Org Title
1\title{Example LaTeX Title}
1= Example AsciiDoc Title
Once defined, titles are displayed in place of the filename and first line
in the output of nb ls
:
1❯ nb ls 2home 3---- 4[3] Example Title 5[2] Sample Title 6[1] Demo Title
Pass an id, filename, or title to view the listing for that note:
1❯ nb ls Sample\ Title 2[2] Sample Title 3 4❯ nb ls 3 5[3] Example Title
If there is no exact match, nb
will list items with
titles and filenames that fuzzy match the query:
1❯ nb ls exa 2[3] Example Title 3 4❯ nb ls ample 5[3] Example Title 6[2] Sample Title
Multiple words act like an OR
filter, listing any
titles or filenames that match any of the words:
1❯ nb ls example demo 2[3] Example Title 3[1] Demo Title
When multiple words are quoted, filter titles and filenames for that phrase:
1❯ nb ls "example title" 2[3] Example Title
For full text search, see Search.
To view excerpts of notes, use the --excerpt
or -e
option,
which optionally accepts a length:
1❯ nb ls 3 --excerpt 2[3] Example Title 3----------------- 4# Example Title 5 6This is an example excerpt. 7 8❯ nb ls 3 -e 8 9[3] Example Title 10----------------- 11# Example Title 12 13This is an example excerpt. 14 15More example content: 16 17- one 18- two
Several classes of file types are represented with emoji
indicators to make them easily identifiable in lists.
For example, bookmarks and encrypted notes are listed with 🔖
and 🔒
:
1❯ nb ls 2home 3---- 4[4] Example Note 5[3] 🔒 encrypted-note.md.enc 6[2] 🔖 Example Bookmark (example.com) 7[1] 🔖 🔒 encrypted.bookmark.md.enc
File types include:
1 🔉 Audio 2 📖 Book 3 🔖 Bookmark 4 🔒 Encrypted 5 📂 Folder 6 🌄 Image 7 📄 PDF, Word, or Open Office document 8 📹 Video
By default, items are listed starting with the most recently modified.
To reverse the order, use the -r
or --reverse
flag:
1❯ nb ls 2home 3---- 4[2] Todos 5[3] Example Title 6[1] Ideas 7 8❯ nb ls --reverse 9[1] Ideas 10[3] Example Title 11[2] Todos
Notes can be sorted with the -s
/ --sort
flag,
which can be combined with -r
/ --reverse
:
1❯ nb ls 2home 3---- 4[2] Sample Title 5[3] Example Title 6[1] Demo Title 7 8❯ nb ls --sort 9[1] Demo Title 10[2] Sample Title 11[3] Example Title 12 13❯ nb ls --sort --reverse 14[3] Example Title 15[2] Sample Title 16[1] Demo Title
nb
with no subcommand behaves like an alias for nb ls
,
so the examples above can be run without the ls
:
1❯ nb 2home 3---- 4[2] Sample Title 5[3] Example Title 6[1] Demo Title 7 8❯ nb example 9[3] Example Title 10 11❯ nb 3 --excerpt 12[3] Example Title 13----------------- 14# Example Title 15 16This is an example excerpt. 17 18❯ nb 3 -e 8 19[3] Example Title 20----------------- 21# Example Title 22 23This is an example excerpt. 24 25More example content: 26 27- one 28- two 29 30❯ nb --sort 31[1] Demo Title 32[2] Sample Title 33[3] Example Title 34 35❯ nb --sort --reverse 36[3] Example Title 37[2] Sample Title 38[1] Demo Title
Short options can be combined for brevity:
1# equivalent to `nb --sort --reverse --excerpt 2` and `nb -s -r -e 2`: 2❯ nb -sre 2 3[3] Example Title 4----------------- 5# Example Title 6 7[2] Sample Title 8---------------- 9Sample Title 10============ 11[1] Demo Title 12-------------- 13--- 14title: Demo Title
nb
and nb ls
display the 15 most recently modified items.
The default limit can be changed with nb set limit <number>
.
To list a different number of items on a per-command basis, use the
-n <limit>
,
--limit <limit>
,
--<limit>
,
-a
,
and --all
flags:
1❯ nb -n 1 2home 3---- 4[5] Example Five 54 omitted. 5 total. 6 7❯ nb --limit 2 8home 9---- 10[5] Example Five 11[4] Example Four 123 omitted. 5 total. 13 14❯ nb --3 15home 16---- 17[5] Example Five 18[4] Example Four 19[3] Example Three 202 omitted. 5 total. 21 22❯ nb --all 23home 24---- 25[5] Example Five 26[4] Example Four 27[3] Example Three 28[2] Example Two 29[1] Example One
Lists can be paginated with
-p <number>
/ --page <number>
,
which paginates by the value of nb set limit
by
default, or the value of
-n <limit>
,
--limit <limit>
,
or --<limit>
when present:
1❯ nb 2home 3---- 4[6] Example Six 5[5] Example Five 6[4] Example Four 7[3] Example Three 8[2] Example Two 9[1] Example One 10 11❯ nb set limit 3 12NB_LIMIT set to 3 13 14❯ nb --page 1 15[6] Example Six 16[5] Example Five 17[4] Example Four 18 19❯ nb -p 2 20[3] Example Three 21[2] Example Two 22[1] Example One 23 24❯ nb -p 2 --limit 2 25[4] Example Four 26[3] Example Three 27 28❯ nb -p 3 --2 29[2] Example Two 30[1] Example One
List #tagged items by passing \#escaped
or "#quoted"
hashtags
or tags specified with the --tags
option. Multiple tags perform an
AND
query:
1# list items in the current notebook tagged with "#tag1", escaped 2nb \#tag1 3 4# list items in the "example" notebook tagged with "#tag2", quoted 5nb example: "#tag2" 6 7# list items in all notebooks tagged with "#tag1", long option 8nb \#tag1 --all 9 10# list items in the current notebook tagged with "#tag1" AND "#tag2" 11nb \#tag1 "#tag2" 12 13# list items in all notebooks tagged with "#tag2" AND "#tag3", short option 14nb --tags tag2,tag3 -a
nb ls
is a combination of
nb notebooks
and nb list
in one view and accepts the same arguments as nb list
,
which lists only notes without the notebook list and with no limit by default:
1❯ nb list 2[100] Example One Hundred 3[99] Example Ninety-Nine 4[98] Example Ninety-Eight 5... lists all notes ... 6[2] Example Two 7[1] Example One
For more information about options for listing notes, run
nb help ls
and
nb help list
.
Listing with browse
Items can be listed within terminal and GUI web browsers using
nb browse
/ nb b
:
1❯ nb browse example:sample/demo/ 2❯nb · example : sample / demo / + 3 4search: [ ] 5 6[example:sample/demo/7] Title Seven 7[example:sample/demo/6] Title Six 8[example:sample/demo/5] Title Five 9[example:sample/demo/4] Title Four 10[example:sample/demo/3] Title Three 11 12next ❯
For more information, see Browsing.
Editing
You can edit an item in your editor with
nb edit
(shortcut: nb e
):
1# edit note by id 2nb edit 3 3 4# edit note by filename 5nb edit example.md 6 7# edit note by title 8nb edit "A Document Title" 9 10# edit note 12 in the notebook named "example" 11nb edit example:12 12 13# edit note 12 in the notebook named "example", alternative 14nb example:12 edit 15 16# edit note 12 in the notebook named "example", alternative 17nb example:edit 12
edit
and other subcommands that take an identifier
can be called with the identifier and subcommand name reversed:
1# edit note by id 2nb 3 edit
nb edit
can also receive piped content, which it
appends to the specified note without opening the editor:
1echo "Content to append." | nb edit 1
Content can be passed with the --content <content>
option,
which also appends the content without opening the editor:
1nb edit 1 --content "Content to append."
Use the --overwrite
option to overwrite existing file content
and the --prepend
option to prepend the new content before existing content.
When content is piped or specified with --content <content>
,
use the --edit
flag to open the file in the editor
before the change is committed.
Editing Encrypted Notes
When a note is encrypted,
nb 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
can be called by the shortcut alias, nb e
:
1# edit note by id 2nb e 3 3 4# edit note by filename 5nb e example.md 6 7# edit note by title 8nb e "A Document Title" 9 10# edit note by id, alternative 11nb 3 e 12 13# edit note 12 in the notebook named "example" 14nb e example:12 15 16# edit note 12 in the notebook named "example", alternative 17nb example:12 e 18 19# edit note 12 in the notebook named "example", alternative 20nb example:e 12
For nb edit
help information, run nb help edit
.
Editing with browse
Items can be edited within terminal and GUI web browsers using
nb browse edit
/ nb b e
:
1❯ nb browse edit text:formats/markdown/123 2❯nb · text : formats / markdown / 123 · ↓ · editing · - | + 3 4[# Daring Fireball: Markdown (daringfireball.net) ] 5[ ] 6[<https://daringfireball.net/projects/markdown/> ] 7[ ] 8[## Related ] 9[ ] 10[- <https://en.wikipedia.org/wiki/Markdown> ] 11[ ] 12[## Comments ] 13[ ] 14[See also: ] 15[ ] 16[- [[text:formats/org]] ] 17[- [[cli:apps/nb]] ] 18[ ] 19[## Tags ] 20[ ] 21 22[save] · last: 2021-01-01 01:00:00
For more information, see
browse edit
and Browsing.
Viewing
↑ ·
nb show
,
nb browse
,
nb open
,
nb peek
Notes and other items can be viewed using
nb show
(shortcut: nb s
):
1# show note by id 2nb show 3 3 4# show note by filename 5nb show example.md 6 7# show note by title 8nb show "A Document Title" 9 10# show note by id, alternative 11nb 3 show 12 13# show note 12 in the notebook named "example" 14nb show example:12 15 16# show note 12 in the notebook named "example", alternative 17nb example:12 show 18 19# show note 12 in the notebook named "example", alternative 20nb example:show 12
By default, nb show
opens notes in
less
,
with syntax highlighting if
bat
,
highlight
,
or
Pygments
is installed.
You can navigate in less
using the following keys:
1Key Function 2--- -------- 3mouse scroll Scroll up or down 4arrow up or down Scroll one line up or down 5f Jump forward one window 6b Jump back one window 7d Jump down one half window 8u Jump up one half window 9/<query> Search for <query> 10n Jump to next <query> match 11q Quit
If less
scrolling isn't working in iTerm2,
go to
"Settings"
-> "Advanced"
-> "Scroll wheel sends arrow keys when in alternate screen mode"
and change it to "Yes".
More Info
Use the -p
/ --print
option
to print to standard output with syntax highlighting:
1❯ nb show 123 --print 2# Example Title 3 4Example content: 5 6- one 7- two 8- three
Use nb show --print --no-color
to print without syntax highlighting.
When Pandoc is available,
use the -r
/ --render
option to
render the note to HTML and open it in your terminal browser:
1nb show example.md --render 2# opens example.md as an HTML page in w3m, links, or lynx
nb 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
.
Supported file types and tools include:
- Markdown files (
$NB_MARKDOWN_TOOL
): - PDF files:
termpdf.py
with kittypdftotext
- Audio files (
$NB_AUDIO_TOOL
): - Images (
$NB_IMAGE_TOOL
):catimg
- Chafa
- ImageMagick with a terminal that supports sixels
imgcat
with iTerm2- kitty's
icat
kitten termvisage
timg
viu
- Folders, Directories, Notebooks (
$NB_DIRECTORY_TOOL
): - Word Documents:
- Excel, CSV, TSV, and data files (
$NB_DATA_TOOL
): - EPUB ebooks:
When using nb show
with other file types or
if the above tools are not available,
nb show
opens files in
your system's preferred application for each type.
nb show
also provides options for
querying information about an item. For example, use the
--added
/ -a
and --updated
/ -u
flags to print the date and time that an item was added or updated:
1❯ nb show 2 --added 22020-01-01 01:01:00 -0700 3 4❯ nb show 2 --updated 52020-02-02 02:02:00 -0700
nb show
is primarily intended for viewing items within the terminal.
To view a file in the system's preferred GUI application, use
nb open
.
To browse rendered items in terminal and GUI web browsers, use
nb browse
.
For full nb show
usage information, run nb help show
.
Shortcut Alias: nb s
nb show
can be called using the shortcut alias nb s
:
1# show note by id 2nb s 3 3 4# show note by filename 5nb s example.md 6 7# show note by title 8nb s "A Document Title" 9 10# show note by id, alternative 11nb 3 s 12 13# show note 12 in the notebook named "example" 14nb s example:12 15 16# show note 12 in the notebook named "example", alternative 17nb example:12 s 18 19# show note 12 in the notebook named "example", alternative 20nb example:s 12
Alias: nb view
nb show
can also be invoked with nb view
for convenience:
1# show note by id 2nb view 3 3 4# show note by filename 5nb view example.md 6 7# show note by title 8nb view "A Document Title" 9 10# show note by id, alternative 11nb 3 view
Viewing with browse
Items can be viewed within terminal and GUI web browsers using
nb browse
/ nb b
:
1❯ nb browse text:formats/markdown/123 2❯nb · text : formats / markdown / 123 · ↓ · edit | + 3Daring Fireball: Markdown (daringfireball.net) 4 5https://daringfireball.net/projects/markdown/ 6 7Related 8 9 • https://en.wikipedia.org/wiki/Markdown 10 11Comments 12 13See also: 14 15 • [[text:formats/org]] 16 • [[cli:apps/nb]] 17 18Tags 19 20#markup #plain-text 21 22Content 23 24Daring Fireball: Markdown 25 26Download 27 28Markdown 1.0.1 (18 KB) — 17 Dec 2004 29 30Introduction 31 32Markdown is a text-to-HTML conversion tool for web writers. Markdown allows 33you to write using an easy-to-read, easy-to-write plain text format, then 34convert it to structurally valid XHTML (or HTML).
For more information, see Browsing.
Deleting
↑ ·
nb delete
,
nb browse delete
To delete one or more notes, pass any number of
ids, filenames, titles, and other selectors
to nb delete
(shortcuts: nb d
, nb -
):
1# delete item by id 2nb delete 3 3 4# delete item by filename 5nb delete example.md 6 7# delete item by title 8nb delete "A Document Title" 9 10# delete item by id, alternative 11nb 3 delete 12 13# delete item 12 in the notebook named "example" 14nb delete example:12 15 16# delete item 12 in the notebook named "example", alternative 17nb example:12 delete 18 19# delete item 12 in the notebook named "example", alternative 20nb example:delete 12 21 22# delete item 345 in the folder named "example" 23nb delete example/345 24 25# delete items with the ids 89, 56, and 21 26nb delete 89 56 21
By default, nb delete
will display a confirmation prompt.
To skip, use the --force
/ -f
option:
1nb delete 3 --force
Shortcut Aliases: nb d
, nb -
nb delete
has the aliases nb d
and nb -
:
1# delete note by id 2nb d 3 3 4# delete note by filename 5nb d example.md 6 7# delete note by title 8nb - "A Document Title" 9 10# delete note by id, alternative 11nb 3 d 12 13# delete note 12 in the notebook named "example" 14nb - example:12 15 16# delete note 12 in the notebook named "example", alternative 17nb example:12 d 18 19# delete note 12 in the notebook named "example", alternative 20nb example:d 12
For nb delete
help information, run nb help delete
.
Deleting with nb browse
Items can be deleted within terminal and GUI web browsers using
nb browse delete
/ nb b d
:
1❯ nb browse delete example:4 2❯nb · example : 4 · ↓ · edit · - | + 3 4 deleting 5 6[4] example_file.md "Example Title" 7 8 [delete] 9
For more information, see 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, and manage
collections of bookmarks.
Bookmarks in nb
are stored as
simple structured Markdown files
containing information extracted from the bookmarked pages.
To create a new bookmark, pass a URL as the first argument to nb
:
1nb https://example.com
nb
automatically generates a bookmark using information from the page:
1# Example Title (example.com) 2 3<https://example.com> 4 5## Description 6 7Example description. 8 9## Content 10 11Example Title 12============= 13 14This domain is for use in illustrative examples in documents. You may 15use this domain in literature without prior coordination or asking for 16permission. 17 18[More information\...](https://www.iana.org/domains/example)
nb
embeds the page content in the bookmark, making it available for
full text search with nb search
and
locally-served, distraction-free reading and browsing
with nb browse
.
When Pandoc is installed,
the HTML page content is converted to Markdown.
When readability-cli
is installed, markup is cleaned up to focus on content. When
Chromium or
Chrome is installed,
JavaScript-dependent pages are rendered and the resulting markup is
saved.
In addition to caching the page content,
you can also include a quote from the page in a
## Quote
section
using the
-q <quote>
/ --quote <quote>
option:
1nb https://example.com --quote "Example quote line one. 2 3Example quote line two."
1# Example Title (example.com) 2 3<https://example.com> 4 5## Description 6 7Example description. 8 9## Quote 10 11> Example quote line one. 12> 13> Example quote line two. 14 15## Content 16 17Example Title 18============= 19 20This domain is for use in illustrative examples in documents. You may 21use this domain in literature without prior coordination or asking for 22permission. 23 24[More information\...](https://www.iana.org/domains/example)
Add a comment in a ## Comment
section using the
-c <comment>
/ --comment <comment>
option:
1nb https://example.com --comment "Example comment."
1# Example Title (example.com) 2 3<https://example.com> 4 5## Description 6 7Example description. 8 9## Comment 10 11Example comment. 12 13## Content 14 15Example Title 16============= 17 18This domain is for use in illustrative examples in documents. You may 19use this domain in literature without prior coordination or asking for 20permission. 21 22[More information\...](https://www.iana.org/domains/example)
Add related URLs and linked selectors
to a ## Related
section using the
-r (<url> | <selector>)
/
--related (<url> | <selector>)
option:
1nb https://example.com --related example:123 -r https://example.net
1# Example Title (example.com) 2 3<https://example.com> 4 5## Description 6 7Example description. 8 9## Related 10 11- [[example:123]] 12- <https://example.net> 13 14## Content 15 16Example Title 17============= 18 19This domain is for use in illustrative examples in documents. You may 20use this domain in literature without prior coordination or asking for 21permission. 22 23[More information\...](https://www.iana.org/domains/example)
Bookmarks can be tagged using the
-t <tag1>,<tag2>...
/
--tags <tag1>,<tag2>...
option.
Tags are converted into #hashtags and
added to a ## Tags
section:
1nb https://example.com --tags tag1,tag2
1# Example Title (example.com) 2 3<https://example.com> 4 5## Description 6 7Example description. 8 9## Tags 10 11#tag1 #tag2 12 13## Content 14 15Example Title 16============= 17 18This domain is for use in illustrative examples in documents. You may 19use this domain in literature without prior coordination or asking for 20permission. 21 22[More information\...](https://www.iana.org/domains/example)
Search for tagged bookmarks with
nb search
/ nb q
:
1nb search --tag tag1 2 3nb q -t tag1 4 5nb q \#tag1
nb search
/ nb q
automatically searches archived page content:
1❯ nb q "example query" 2[10] 🔖 example.bookmark.md "Example Bookmark (example.com)" 3------------------------------------------------------------ 45:Lorem ipsum example query.
Bookmarks can also be encrypted:
1# create a new password-protected, encrypted bookmark 2nb https://example.com --encrypt
Encrypted bookmarks require a password before they can be viewed or opened.
Listing and Filtering Bookmarks
Bookmarks are included in
nb
,
nb ls
,
nb list
,
and nb browse
along with items of other types.
nb bookmark
and nb bookmark list
can be used to
list and filter only bookmarks:
1❯ nb bookmark 2Add: nb <url> Help: nb help bookmark 3------------------------------------ 4[3] 🔖 🔒 example.bookmark.md.enc 5[2] 🔖 Bookmark Two (example.com) 6[1] 🔖 Bookmark One (example.com) 7 8❯ nb bookmark list two 9[2] 🔖 Bookmark Two (example.com)
Bookmarks are also included in nb
, nb ls
, and nb list
:
1❯ nb 2home 3---- 4[7] 🔖 Bookmark Three (example.com) 5[6] Example Note 6[5] 🔖 Bookmark Two (example.net) 7[4] Sample Note 8[3] 🔖 🔒 example-encrypted.bookmark.md.enc 9[2] Demo Note 10[1] 🔖 Bookmark One (example.com)
Use the --type <type>
/ --<type>
option as a filter to display only bookmarks:
1❯ nb --type bookmark 2[7] 🔖 Bookmark Three (example.com) 3[5] 🔖 Bookmark Two (example.net) 4[3] 🔖 🔒 example-encrypted.bookmark.md.enc 5[1] 🔖 Bookmark One (example.com) 6 7❯ nb --bookmark 8[7] 🔖 Bookmark Three (example.com) 9[5] 🔖 Bookmark Two (example.net) 10[3] 🔖 🔒 example-encrypted.bookmark.md.enc 11[1] 🔖 Bookmark One (example.com)
nb
saves the domain in the title, making it easy to filter by domain
using any list subcommands:
1❯ nb example.com 2[7] 🔖 Bookmark Three (example.com) 3[1] 🔖 Bookmark One (example.com)
For more listing options, see
nb help ls
,
nb help list
,
and nb help bookmark
.
Shortcut Aliases: nb bk
, nb bm
nb bookmark
can also be used with the aliases
nb bk
and nb bm
:
1❯ nb bk 2Add: nb <url> Help: nb help bookmark 3------------------------------------ 4[7] 🔖 Bookmark Three (example.com) 5[5] 🔖 Bookmark Two (example.net) 6[3] 🔖 🔒 example-encrypted.bookmark.md.enc 7[1] 🔖 Bookmark One (example.com) 8 9❯ nb bm example.net 10[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
(shortcut: nb b
)
to browse bookmarks with cached content,
[[wiki-style links]],
linked #tags, and external links:
1❯ nb browse text:formats/markdown/123 2❯nb · text : formats / markdown / 123 · ↓ · edit | + 3Daring Fireball: Markdown (daringfireball.net) 4 5https://daringfireball.net/projects/markdown/ 6 7Related 8 9 • https://en.wikipedia.org/wiki/Markdown 10 11Comments 12 13See also: 14 15 • [[text:formats/org]] 16 • [[cli:apps/nb]] 17 18Tags 19 20#markup #plain-text 21 22Content 23 24Daring Fireball: Markdown 25 26Download 27 28Markdown 1.0.1 (18 KB) — 17 Dec 2004 29 30Introduction 31 32Markdown is a text-to-HTML conversion tool for web writers. Markdown allows 33you to write using an easy-to-read, easy-to-write plain text format, then 34convert it to structurally valid XHTML (or HTML).
For more information, see Browsing.
nb open
(shortcut: nb o
) opens the bookmarked URL in
your system's primary web browser:
1# open bookmark by id 2nb open 3 3 4# open bookmark 12 in the notebook named "example" 5nb open example:12 6 7# open bookmark 12 in the notebook named "example", alternative 8nb example:12 open 9 10# open bookmark 12 in the notebook named "example", alternative 11nb example:open 12
N.B. To use nb open
with
WSL,
install wslu.
nb peek
(shortcut: nb p
, alias: nb preview
)
opens the bookmarked URL in your terminal web browser,
such as
w3m,
Links, or
Lynx:
1# peek bookmark by id 2nb peek 3 3 4# peek bookmark 12 in the notebook named "example" 5nb peek example:12 6 7# peek bookmark 12 in the notebook named "example", alternative 8nb example:12 peek 9 10# peek bookmark 12 in the notebook named "example", alternative 11nb example:peek 12
nb open
and nb peek
work seamlessly with encrypted bookmarks.
nb
simply prompts you for the bookmark's password.
nb open
and nb peek
automatically check whether the URL is still valid.
If the page has been removed, nb
can check
the Internet Archive Wayback Machine
for an archived copy.
The preferred terminal web browser can be set using
the $BROWSER
environment variable,
assigned in ~/.bashrc
, ~/.zshrc
, or similar:
1export BROWSER=lynx
When $BROWSER
is not set, nb
looks for
w3m
,
links
, and
lynx
and uses the first one it finds.
$BROWSER
can also be used to easy specify the terminal browser for
an individual command:
1❯ BROWSER=links nb 12 peek 2# opens the URL from bookmark 12 in links 3 4❯ BROWSER=w3m nb 12 peek 5# opens the URL from bookmark 12 in w3m
nb show
and nb edit
can also be used to view and edit bookmark files,
which include the cached page converted to Markdown.
nb show <id> --render
/ nb show <id> -r
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
and nb peek
can also be used with the shortcut aliases
nb o
and nb p
:
1# open bookmark by id 2nb o 3 3 4# open bookmark 12 in the notebook named "example" 5nb o example:12 6 7# open bookmark 12 in the notebook named "example", alternative 8nb example:12 o 9 10# peek bookmark by id 11nb p 3 12 13# peek bookmark 12 in the notebook named "example" 14nb p example:12 15 16# peek bookmark 12 in the notebook named "example", alternative 17nb 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
:
1nb add example.bookmark.md --content "<https://example.com>"
For a full overview, see
nb
Markdown Bookmark File Format.
bookmark
-- A command line tool for managing bookmarks.
nb
includes bookmark
, a full-featured
command line interface for creating, viewing, searching, and editing bookmarks.
bookmark
is a shortcut for the
nb bookmark
subcommand,
accepting all of the same subcommands and options with identical behavior.
Bookmark a page:
1❯ bookmark https://example.com --tags tag1,tag2 2Added: [3] 🔖 20200101000000.bookmark.md "Example Title (example.com)"
List and filter bookmarks with
bookmark
and bookmark list
:
1❯ bookmark 2Add: bookmark <url> Help: bookmark help 3--------------------------------------- 4[3] 🔖 🔒 example.bookmark.md.enc 5[2] 🔖 Example Two (example.com) 6[1] 🔖 Example One (example.com) 7 8❯ bookmark list two 9[2] 🔖 Example Two (example.com)
View a bookmark in your terminal web browser:
1bookmark peek 2
Open a bookmark in your system's primary web browser:
1bookmark open 2
Perform a full text search of bookmarks and archived page content:
1❯ bookmark search "example query" 2[10] 🔖 example.bookmark.md "Example Bookmark (example.com)" 3------------------------------------------------------------ 45:Lorem ipsum example query.
See bookmark help
for more information.
✅ Todos
↑ ·
nb do
,
nb tasks
,
nb todo
,
nb undo
Use nb todo
(shortcut: nb to
)
to create, list, and update todos.
nb
todos are structured Markdown documents
referencing a single primary todo,
with optional tasks.
Use nb todo add
to create a new todo:
1# create a new todo titled "Example todo one." 2❯ nb todo add "Example todo one." 3Added: [1] ✔️ [ ] Example todo one. 4 5❯ nb show 1 --print 6# [ ] Example todo one.
Use the --due <date>
option to add an optional due date in a
## Due
section:
1# create a new todo titled "Example todo two." with a due date of "2100-01-01" 2❯ nb todo add "Example todo two." --due "2100-01-01" 3Added: [2] ✔️ [ ] Example todo two. 4 5❯ nb show 2 --print 6# [ ] Example todo two. 7 8## Due 9 102100-01-01
Add an optional description with the
--description <description>
option:
1❯ nb todo add "Example todo three." --description "Example description." 2Added: [3] ✔️ [ ] Example todo three. 3 4❯ nb show 3 --print 5# [ ] Example todo three. 6 7## Description 8 9Example description.
Todos can have tasks.
Tasks added with one or more --task <task>
options
are represented as a markdown task list and placed in a
## Tasks
section:
1❯ nb todo add "Example todo seven." --task "Task one." --task "Task two." --task "Task three." 2Added: [7] ✔️ [ ] Example todo seven. 3 4❯ nb show 7 --print 5# [ ] Example todo seven. 6 7## Tasks 8 9- [ ] Task one. 10- [ ] Task two. 11- [ ] Task three.
Related URLs and linked selectors
can be added to a ## Related
field using the
-r (<url> | <selector>)
/ --related (<url> | <selector>)
option:
1❯ nb todo add "Example todo four." --related example:123 -r https://example.com 2Added: [4] ✔️ [ ] Example todo four. 3 4❯ nb show 4 --print 5# [ ] Example todo four. 6 7## Related 8 9- [[example:123]] 10- <https://example.com>
Tags can be added to todos with the
--tags <tag1>,<tag2>...
option:
1❯ nb todo add "Example todo five." --tags tag1,tag2 2Added: [5] ✔️ [ ] Example todo five. 3 4❯ nb show 5 --print 5# [ ] Example todo five. 6 7## Tags 8 9#tag1 #tag2
Tags, links, and URLs can be
browsed
in terminal and GUI web browsers with nb browse
.
Listing Todos
List todos in with nb todos
:
1# list todos in the current notebook 2❯ nb todos 3[6] ✔️ [ ] Example todo six. 4[5] ✅ [x] Example todo five. 5[4] ✔️ [ ] Example todo four. 6[3] ✅ [x] Example todo three. 7[2] ✅ [x] Example todo two. 8[1] ✔️ [ ] Example todo one. 9 10# list todos in the notebook named "sample" 11❯ nb todos sample: 12[sample:4] ✅ [x] Sample todo four. 13[sample:3] ✔️ [ ] Sample todo three. 14[sample:2] ✔️ [ ] Sample todo two. 15[sample:1] ✅ [x] Sample todo one. 16
Open / undone todos can be listed with nb todos open
:
1# list open todos in the current notebook 2❯ nb todos open 3[6] ✔️ [ ] Example todo six. 4[4] ✔️ [ ] Example todo four. 5[1] ✔️ [ ] Example todo one. 6 7# list open todos in the notebook named "sample" 8❯ nb tasks open sample: 9[sample:3] ✔️ [ ] Sample todo three. 10[sample:2] ✔️ [ ] Sample todo two.
Closed / done todos can be listed with nb todos closed
:
1# list closed todos in the current notebook 2❯ nb todos closed 3[5] ✅ [x] Example todo five. 4[3] ✅ [x] Example todo three. 5[2] ✅ [x] Example todo two. 6 7# list closed todos in the notebook named "sample" 8❯ nb tasks closed sample: 9[sample:4] ✅ [x] Sample todo four. 10[sample:1] ✅ [x] Sample todo one.
See
nb help todo
for more information.
do
/ undo
Mark a todo as done or closed with nb do
:
1# add a new todo titled "Example todo six." 2❯ nb todo add "Example todo six." 3Added: [6] ✔️ [ ] Example todo six. 4 5# mark todo 6 as done / closed 6❯ nb do 6 7Done: [6] ✅ [x] Example todo six.
Re-open a closed todo with nb undo
:
1# mark todo 6 as undone / open 2❯ nb undo 6 3Undone: [6] ✔️ [ ] Example todo six.
See
nb help do
and
nb help undo
for more information.
✔️ Tasks
↑ ·
nb do
,
nb tasks
,
nb todo
,
nb undo
nb
can list and update tasks in 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:
1- [ ] Example open task. 2- [x] Example closed task.
List tasks in items, folders, and notebooks with
nb tasks
(shortcut: nb t
),
which lists both tasks and todos:
1# list tasks in item 7 2❯ nb tasks 7 3[7] ✔️ [ ] Example todo seven. 4------------------------------ 5[7 1] [x] Task one. 6[7 2] [x] Task two. 7[7 3] [ ] Task three. 8 9# list tasks and todos in the notebook named "example" 10❯ nb tasks example: 11[example:9] ✔️ [ ] Example todo nine. 12[example:8] ✅ [x] Example todo eight. 13-------------------------------------- 14[example:8 1] [x] Task one. 15[example:8 2] [x] Task two. 16 17[example:6] ✔️ [ ] Example todo six. 18[example:4] Example Note Title 19------------------------------ 20[example:4 1] [ ] Task one. 21[example:4 2] [x] Task two. 22[example:4 3] [ ] Task three. 23 24[example:3] ✔️ [ ] Example todo three.
Open / undone tasks can be listed with nb tasks open
:
1# list open tasks in item 7 2❯ nb tasks open 7 3[7] ✔️ [ ] Example todo seven. 4------------------------------ 5[7 3] [ ] Task three. 6 7# list open tasks and todos in the notebook named "example" 8❯ nb tasks open example: 9[example:9] ✔️ [ ] Example todo
No vulnerabilities found.
No security vulnerabilities found.