margin-notes
Review HTML and Markdown documents in your browser. Select a passage, leave a comment, and the notes save as JSON next to the document, ready for a person or an LLM agent to act on.
It replaces python -m http.server when the reason you're serving a folder is to read and
critique what's in it.
uvx margin-notes # browse the current folder
uvx margin-notes docs/design.md # open one document
uvx margin-notes ~/reports --host 0.0.0.0 --port 9000
What it does
- Any folder. A listing shows Markdown and HTML documents first, with a count of the notes on each. Other files (images, PDFs, data) are served as-is, so relative links and images work.
- HTML is served unchanged with a small review overlay added. Its own scripts and styles still run.
- Markdown is rendered GitHub-style: tables, task lists, footnotes, definition lists, heading
anchors, front matter (
title:becomes the page title), alerts (> [!NOTE],[!TIP],[!IMPORTANT],[!WARNING],[!CAUTION]), Pygments syntax highlighting, light and dark themes.- Math with MathJax:
$inline$,$$display$$and```mathfences. MathJax only loads on pages that contain math, so prices like$5 and $10are left alone. - Diagrams in
```mermaidfences. - Add
?raw=1to any document URL to get the source.
- Math with MathJax:
- Reviewing: select text and click 💬 Comment. ⌘↵ saves and Esc cancels. Click a highlight to edit or delete it. Notes (bottom right) lists every note in document order, has Copy path and Copy JSON for the notes file, and has + General note for comments about the whole document. Every change saves immediately.
MathJax and mermaid load from jsDelivr, so math and diagrams need internet access. Everything else works offline.
The notes file
report.md gets report.md.notes.json beside it. Using the full filename keeps report.md and
report.html in one folder from sharing a file.
{
"about": "Review notes on report.md. Notes are in document order. ...",
"document": "report.md",
"document_path": "/abs/path/report.md",
"document_sha256": "…",
"updated_at": "2026-11-17T13:43:20-08:00",
"notes": [
{
"id": "nmwl7ygt5zh7r",
"quote": "links five constants",
"section": "Euler and friends",
"comment": "which five?",
"created_at": "2026-11-17T13:43:19-08:00",
"updated_at": "2026-11-17T13:43:20-08:00",
"anchor": { "exact": "links five constants", "prefix": "…", "suffix": "…", "start": 35 }
}
]
}
quoteis the highlighted text andsectionis the nearest heading above it. A note with a nullquoteis a general comment.anchorre-finds the highlight using the exact text and its surroundings. A highlight whose text has since been edited out shows as not found in the notes panel.aboutdescribes the format in plain words, so an agent handed the file needs no other instructions.- If
document_sha256no longer matches the file, the document changed after the review. - Deleting the last note removes the file.
Several people can review the same document at once. Each save changes one note on the server, so reviewers don't overwrite each other.
Options
margin-notes [PATH] [--host HOST] [-p PORT] [--no-open] [--version]
| Option | Default | |
|---|---|---|
PATH |
. |
A folder to browse, or a document to open |
--host |
127.0.0.1 |
0.0.0.0 makes it reachable from your network, and prints the machine's Tailscale URLs if it's on a tailnet |
-p, --port |
8765 |
The first port to try; it moves up if that one is busy |
--no-open |
Don't open a browser |
Security: there is no authentication. Bound to anything other than localhost, anyone who can
reach the port can read every file under the folder and add notes. Dotfiles and dot-directories
(.git, .env) are never served, and nothing outside the folder is reachable, including
through symlinks.
Development
uv sync --all-groups
uv run pytest # unit tests, plus browser tests when Playwright has a browser
uv run playwright install chromium # once, if you have no Chrome or Chromium
uv run pytest -m "not browser" # skip the browser tests
uv run ruff check && uv run ruff format --check
uv run margin-notes . # try it on this repository
The browser tests (tests/test_browser.py) drive the overlay in Chromium through Playwright:
selecting text, anchoring repeated phrases, editing, deleting, general notes, and highlights
that no longer match. They need no network.
Releasing
-
Optional dry run: run the Release workflow by hand from the Actions tab. It builds and publishes to TestPyPI. Check the page, then run the uploaded wheel. Only the wheel comes from TestPyPI; its dependencies come from PyPI, because TestPyPI holds unrelated packages under real names (such as a broken
fastapi 1.0):uvx --refresh --from "margin-notes @ $(curl -s https://test.pypi.org/pypi/margin-notes/json \ | python3 -c 'import json,sys; print(next(u["url"] for u in json.load(sys.stdin)["urls"] if u["filename"].endswith(".whl")))')" \ margin-notes --version
-
Bump
__version__insrc/margin_notes/__init__.pyand add a section toCHANGELOG.md. -
Commit, then tag and push:
git tag v0.1.0 && git push --tags. -
.github/workflows/release.ymlchecks that the tag matches the version, runs the tests, builds, and publishes to PyPI.
Both indexes publish through trusted publishers, so no token lives in GitHub. Set each up once,
for repository jbn/margin-notes and workflow release.yml: at
https://test.pypi.org/manage/account/publishing/ with environment testpypi, and at
https://pypi.org/manage/account/publishing/ with environment pypi.
To publish from your own machine instead, run uv build && uv publish.
Metadata
Release files for margin-notes 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| margin_notes-0.1.1.tar.gz | 33.2 kB | With provenance | Details for margin_notes-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| margin_notes-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for margin_notes-0.1.1-py3-none-any.whl |
Total release size: 58.2 kB
Release files / margin_notes-0.1.1.tar.gz
| Download URL | margin_notes-0.1.1.tar.gz |
|---|---|
| Size | 33.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0d9ee02f43c9d510436acb90c793726ee5883c543579d7d8c033bf5a3bc3de6
|
|
BLAKE2b-256 checksum How to use checksums |
fa2b5f71db478cf44e4a4912c6c59758cebea26d28a41ecdd70bdc305bfd0dca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / margin_notes-0.1.1-py3-none-any.whl
| Download URL | margin_notes-0.1.1-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f80b3d2786fe5e55ad56d6c1f58d662b859cb43226d369a011584b7e53bfb15b
|
|
BLAKE2b-256 checksum How to use checksums |
a79a8789a082ebee2d4b55f4190a355aa19b8fef0618a50a1f7f761b2d5da5f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for margin-notes 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for margin_notes-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.