Plain-text, pass-style bookmarks
Project description
bm — plain‑text bookmarks
A tiny, stdlib‑only bookmark manager inspired by the Unix philosophy and pass:
- One text file per bookmark (
.bm) with front matter + freeform notes - Human‑readable paths with a short hash to avoid collisions
- Stable IDs derived from the URL (rename‑safe)
- Greppable store; composable CLI
- Atomic writes & path‑safety checks
- JSON / JSONL output for pipelines
- Netscape HTML import/export for browser interoperability
- Optional Git sync for history and cross‑device
Works on macOS, Linux, WSL, and Windows (PowerShell). No third‑party dependencies.
Table of contents
Why bm?
Most bookmark tools are databases or browser‑locked. bm chooses text first: plain UTF‑8 files that last decades, are easy to diff, and play well with your editor, shell, and Git. It embraces "do one thing well" and stays small so you can integrate it anywhere.
Install
Requires Python >=3.8. Install with pip (or pipx) to get the bm console script:
git clone https://github.com/jtabke/bkmrk
cd bkmrk
python -m pip install .
Development workflows can pull in the optional extras declared in pyproject.toml:
python -m pip install -e '.[dev]'
Prefer running straight from the repository? The module entry point works without installation:
python -m bm --help
On Windows (PowerShell):
python -m bm --help
Quickstart
# initialize a new store (optionally a git repo)
bm init --git
# import bookmarks from a browser export (Netscape HTML)
bm import netscape ~/Downloads/bookmarks.html
# add a bookmark
bm add https://example.com -n "Example" -t ref,demo -d "Short note"
# list newest bookmarks (ID, path, title, URL)
bm list
# search across title/url/tags/body
bm search kernel
# search within a specific path
bm search kernel --path dev/linux
# list directory prefixes
bm dirs
# open the first result
ID=$(bm search kernel --jsonl | head -1 | jq -r '.id')
bm open "$ID"
# export for browsers (Netscape HTML)
bm export netscape > bookmarks.html
Concepts
Store layout
Default store directory is ~/.bookmarks.d (override via $BOOKMARKS_DIR). Each bookmark is a single .bm file; directories serve as namespaces.
~/.bookmarks.d/
dev/python/fastapi-3a1b2c4.bm
news-ycombinator-com-1234567.bm
README.txt
File names are human readable and end with a short hash of the URL to avoid collisions.
Bookmark file format
Each .bm file contains front matter and an optional body:
---
url: https://example.com/blog/post
title: Great post
tags: [read, blog, "needs,comma"]
created: 2025-09-16T08:42:00-07:00
modified: 2025-09-17T09:10:00-07:00
---
Longer notes, checklists, code blocks…
tagsis a list and supports quoting for commas/spaces- Any extra keys are preserved on round‑trip
IDs
Each bookmark has a stable ID derived from its URL (BLAKE2b short hash). The ID does not change if you rename/move the file. You can use either the ID or a path‑like slug with commands.
CLI usage
Run bm --help or bm <command> --help for command details.
init
Create a store; optional --git initializes a Git repo.
bm init --git
add
Add a bookmark. --edit opens your $EDITOR with a pre‑filled template.
bm add <url> [-n TITLE] [-t tag1,tag2] [-d NOTES] [-p dir1/dir2] [--id SLUG] [--edit] [-f]
Prints the stable ID on success.
list
List bookmarks (newest first).
bm list [--host HOST] [--since ISO|YYYY-MM-DD] [-t TAG] [--path PREFIX] [--json|--jsonl]
search
Full‑text search across title, url, tags, and body.
bm search <query> [--path PREFIX] [--json|--jsonl]
show and open
Display metadata/notes or open the URL in your default browser:
bm show <ID|path>
bm open <ID|path>
edit, rm, mv
bm edit <ID|path> # bumps modified timestamp
bm rm <ID|path>
bm mv <SRC> <DST> [-f]
tags and tag add|rm
List discovered tags (from folder segments and header tags), or mutate tags without opening an editor.
bm tags
bm tag add <ID|path> tag1 tag2
bm tag rm <ID|path> tag1
dirs
List all known directory prefixes in the bookmark store.
bm dirs [--json]
export and import
Netscape HTML (for browsers) and JSON exports; Netscape import with folder hierarchies preserved.
bm export netscape [--host HOST] [--since ISO|YYYY-MM-DD] > bookmarks.html
bm export json > dump.json
bm import netscape bookmarks.html [-f]
sync
If the store is a Git repo, stage/commit and (if upstream exists) push.
bm sync
Filtering & output formats
--hostmatches the URL host (case‑insensitive, ignores leadingwww.)--pathfilters by path prefix (e.g.,--path dev/pythonshows only entries under that directory tree)--sinceacceptsYYYY-MM-DDor full ISO timestamps; comparisons are proper datetimes--jsonemits a single JSON array;--jsonloutputs one JSON object per line (NDJSON)
Common JSON schema fields: id, path, title, url, tags, created, modified.
Integration recipes
fzf launcher
bm list --jsonl | fzf --with-nth=2.. | awk '{print $1}' | xargs -r bm open
Open the latest saved from a host
bm list --host example.com --jsonl | head -1 | jq -r '.id' | xargs -r bm open
Bulk tag HN links
bm list --host news.ycombinator.com --jsonl | jq -r '.id' | xargs -n1 bm tag add hn
List bookmarks in a specific category
bm list --path dev/python
bm search "framework" --path dev
Explore directory structure
bm dirs
bm dirs --json | jq
Export → browser import
bm export netscape > ~/Desktop/bookmarks.html
# Import that file in your browser’s bookmarks manager
Sync with Syncthing
For cross-device synchronization without Git, use Syncthing to sync your bookmark store:
- Install Syncthing on all devices.
- Add your bookmark store directory (
~/.bookmarks.dor$BOOKMARKS_DIR) as a synced folder in Syncthing. - Configure devices to share the folder bidirectionally.
- Syncthing will keep your bookmarks in sync across devices automatically.
Auto-export for browser import
To automatically export bookmarks to Netscape HTML for browser import:
#!/bin/bash
# auto_export.sh
bm export netscape > ~/bookmarks_auto.html
echo "Bookmarks exported to ~/bookmarks_auto.html. Import this file in your browser."
Run this script periodically or on demand to generate an up-to-date bookmark file for browser import.
Configuration
- Store directory: set
BOOKMARKS_DIRor pass--storeto any command - Editor:
VISUALorEDITOR(supports commands likecode --wait)
Windows notes:
- Paths avoid reserved names and use atomic replaces; long paths depend on OS settings
Security & robustness
- Atomic writes: all modifications write to a temp file then
os.replaceit - Path safety:
..and absolute paths are rejected; files cannot escape the store - No network by default:
bmnever fetches content (future hooks can) - Git: pushes only if an upstream is configured
Migration notes
From older versions where IDs depended on path: IDs are now URL‑only (stable across renames). Old files remain valid; tags as comma strings are still read and normalized to lists on save.
Development
# lint (optional) — stdlib only, so just run the script
python3 -m py_compile bm.py
# run tests (if added)
pytest -q
Roadmap / ideas
bm dedupe(merge by normalized URL, union tags)bm reindex+ optional on‑disk index for very large stores- Markdown/CSV exports
- Simple HTTP UI (
bm serve) and browser extension hooks - Optional encryption (GPG or git‑crypt) for private notes
License
MIT. Do what you want; a credit is appreciated.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bkmrk-0.1.0.tar.gz.
File metadata
- Download URL: bkmrk-0.1.0.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7e298e3366281686563c3df6bcdad1a6cf4d2f36bd022df3d51336ab2368981
|
|
| MD5 |
4eeb9898aef212909c3656e51a2a5b50
|
|
| BLAKE2b-256 |
dd69eddcb67e23b868ecf3806c2f2d853e0df9a886b081db9ef16db36cb92cf4
|
Provenance
The following attestation bundles were made for bkmrk-0.1.0.tar.gz:
Publisher:
publish.yml on jtabke/bkmrk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bkmrk-0.1.0.tar.gz -
Subject digest:
b7e298e3366281686563c3df6bcdad1a6cf4d2f36bd022df3d51336ab2368981 - Sigstore transparency entry: 566844490
- Sigstore integration time:
-
Permalink:
jtabke/bkmrk@d1d10137f76d8d1e45285747276629bb4829243f -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/jtabke
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d1d10137f76d8d1e45285747276629bb4829243f -
Trigger Event:
push
-
Statement type:
File details
Details for the file bkmrk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bkmrk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baf8464ab1418db4f501a18450f7bac64db7ead5de35e9e7c101e7398e725e03
|
|
| MD5 |
45c2e8f91807e0e9cf6995762501f52c
|
|
| BLAKE2b-256 |
a431af260b4f15e01adcdc41aba4f675583c0cd48378c453495903ca11a1ec54
|
Provenance
The following attestation bundles were made for bkmrk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on jtabke/bkmrk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bkmrk-0.1.0-py3-none-any.whl -
Subject digest:
baf8464ab1418db4f501a18450f7bac64db7ead5de35e9e7c101e7398e725e03 - Sigstore transparency entry: 566844497
- Sigstore integration time:
-
Permalink:
jtabke/bkmrk@d1d10137f76d8d1e45285747276629bb4829243f -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/jtabke
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d1d10137f76d8d1e45285747276629bb4829243f -
Trigger Event:
push
-
Statement type: