Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/xwmx/nb/llms.txt

Use this file to discover all available pages before exploring further.

nb derives metadata from three sources: the Git history of the notebook repository, the filesystem, and the content of each file. This layered approach means timestamps are reliable and portable across machines, item ordering is stable and committed to version control, and user-defined metadata lives alongside content in plain text.

Git-Derived Timestamps

nb reads commit history using git log to supply accurate timestamps — not filesystem ctime or mtime values, which can be reset by operations like rsync or cloning:
# print the datetime when item 2 was first added
nb show 2 --added

# print the datetime when item 2 was last modified
nb show 2 --updated

# list the git commit authors who have edited item 2
nb show 2 --authors
OptionSourceDescription
--added / -aFirst git commit containing the fileCreation datetime
--updated / -uMost recent git commit modifying the fileLast change datetime
--authorsAll commit authors for the fileContributor list
The filesystem’s modified timestamp is still used for sorting (e.g., most recently touched items appear first in listings), while the git-derived values are used only for display.

YAML Front Matter

User-defined metadata can be added to any note using front matter. Front matter is a block of YAML enclosed in triple-dashed lines (---) at the very start of a Markdown file:
---
title:  Example Title
author: xwmx
year:   2021
---

Example content.

More example content:

- one
- two
- three
nb reads the title: field for listing, filtering, and item selection. All other fields are stored in the file but are not parsed or interpreted by nb — they are yours to define.

Title Field

When a title: field is present in a note’s front matter, nb uses it instead of the filename when displaying the item in listings and when resolving title-based selectors:
# this selector resolves to the note whose front matter has title: "My Note"
nb show "My Note"

Custom Fields

Any additional key–value pairs in the front matter block are preserved verbatim and available to external tools, templates, and scripts. Simple scalar values use key: value syntax; complex data can use full YAML capabilities:
---
title:    Project Specification
author:   xwmx
created:  2024-01-15
tags:
  - project
  - specification
priority: high
reviewed: false
---

Internal State Files

nb uses several plain text files committed to Git to track item ordering, pinning, and notebook archival state. These files are managed automatically by nb — editing them manually may corrupt your notebook.
The .index, .pindex, and .archived files are internal to nb. Use nb index reconcile to repair a corrupted .index rather than editing it by hand.

.index Files

Every folder in a notebook contains a .index file — a plain text list of filenames, one per line. The line number of each filename is its stable numeric id:
example-note.md
another-note.md
demo.bookmark.md

fourth-item.md
Blank lines in .index represent deleted items whose ids are preserved as gaps. This is how nb keeps ids stable even after deletions.
Because .index is committed to Git, ids are consistent across all clones of a notebook. The supported operations on an index are:
OperationEffect
addAppend a new filename line to .index
updateOverwrite an existing filename entry with a new filename
deleteRemove the filename but preserve the blank line (keeping the id slot)
reconcileRemove duplicates, add entries for new files, delete entries for removed files
rebuildDelete and fully reconstruct .index sorted by last-modified (ids may change)
The internal nb index subcommand manages .index files. You can inspect it directly:
# show the .index for the current folder
nb index show

# reconcile (safe repair) the index for the current folder
nb index reconcile

# reconcile all ancestor folders in the notebook
nb index reconcile --ancestors

.pindex Files

Any folder may optionally contain a .pindex file — a plain text list of basenames that should be treated as pinned. Pinned items appear first in listings produced by nb and nb ls:
important-note.md
project-spec.bookmark.md
Entries are managed with nb pin and nb unpin:
# pin item 3 (adds its filename to .pindex)
nb pin 3

# unpin item 3 (removes its filename from .pindex)
nb unpin 3

.archived Files

A notebook is considered archived when its root directory contains a file named .archived. Archived notebooks are hidden from default listings but remain accessible.
# archive the "example" notebook (creates example/.archived)
nb notebooks archive example

# unarchive it (removes example/.archived)
nb notebooks unarchive example

Bookmark and Todo File Formats

nb encodes additional semantic metadata through file extensions and content structure rather than external databases.

Bookmark Files (.bookmark.md)

Bookmarks are Markdown files with a .bookmark.md extension. The bookmark URL is the first angle-bracket-wrapped URL in the file. Sections are separated by Markdown h2 headings:
# Example Title (example.com)

<https://example.com>

## Description

Example description.

## Tags

#tag1 #tag2

## Content

Page content converted to Markdown.
The only required element is the URL. All other sections (## Description, ## Quote, ## Comment, ## Related, ## Tags, ## Content, ## Source) are optional.

Todo Files (.todo.md)

Todos are Markdown files with a .todo.md extension. The h1 heading contains a Markdown checkbox indicating completion state:
# [ ] Example open todo title.

## Due

2100-01-01

## Description

Example description.

## Tasks

- [ ] One
- [x] Two
- [ ] Three

## Tags

#tag1 #tag2
[ ] in the heading means the todo is open; [x] means it is done.

Build docs developers (and LLMs) love