8000 feat(notes): download a note, or all of a namespace's notes, as Markdown by adeelahmad · Pull Request #419 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(notes): download a note, or all of a namespace's notes, as Markdown - #419

Merged
adeelahmad merged 6 commits into
mainfrom
claude/project-thread-wm7xc9
Oct 17, 2026
Merged

adeelahmad merged 6 commits into
mainfrom
claude/project-thread-wm7xc9

Conversation

@adeelahmad
@adeelahmad adeelahmad commented Oct 15, 2026 •
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: notes could not leave Lens as files; there was no way to take them to Obsidian or any other notes app.

After: Download as Markdown in a note's ⋯ menu in the tree saves it as a .md file. Download all as Markdown in the Notes page's ⋯ menu saves every page of the namespace as a zip of Markdown files, with the notes inside a note in a folder named like it and the pages of recordings, entities and topics under Pages of things. Each file starts with front matter (title, date, where it's filed, summary, what it's the page of), and links to other notes become [[Title]] wiki links (other mentions become the names they link to).

How: notebook.markdown() writes one page (front matter plus the body with mentions rewritten); notebook.export() writes the zip into a spooled temp file, naming files safely and numbering duplicates (budget (2).md). GET /api/v1/notes/{pid}/markdown and GET /api/v1/notes/export?ns= serve them with a UTF-8 Content-Disposition; components/notes/download.ts (useNoteDownloads) downloads with the session token.

Also: the clicks survey's graph-merge journey failed here (Clicks and keystrokes per feature). The failure screenshot showed neither Lens nor Raspberry Pi in the graph. The backend log showed why: import-file's pi-episode took 40 s to read in Chromium on that runner, and its analysis landed between entity-merge's merge and its Undo. entity-merge now waits for the imports' jobs to finish first, as graph-merge already did (not counted as clicks).

Motivation and Context

Part of the notes UI audit (Adeel: "notes ui is very bad and is missing tons of things"): export is in every notes app, and it keeps notes open rather than locked in.

Steps to reproduce (if appropriate):

Notes tree → ⋯ on a note → Download as Markdown. Notes page → ⋯ → Download all as Markdown → open the zip in Obsidian as a vault.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

Done questions (AGENTS.md)

  • Goal: a note or all of a namespace's notes download as Markdown; merged on green CI.
  • Agents: GET /api/v1/notes/{pid}/markdown and GET /api/v1/notes/export?ns= with any token that can read the namespace.
  • Zero setup: nothing to install or configure.
  • Fewest clicks: two for a note (⋯, Download), two for everything.
  • Configurable: n/a, no new settings.
  • Light: standard library zipfile only, spooled to disk past 32 MB.
  • Private and secure: readers of the namespace only (others get 404); the download stays on the person's device. Files of notes are not in the zip.
  • Cost: no model calls.
  • User decides: nothing downloads on its own; defaults unchanged.
  • Upgrades: nothing stored changes.
  • Honest: docs describe what is built.
  • Tests (backend test_markdown_export: front matter, wiki links follow renames, folders follow the tree, duplicate names, outsiders refused; web: tree and Notes page menus) and docs (docs/notes.md Downloading as Markdown, docs/api.md) updated; make openapi regenerated. Local: backend 1121 passed, web 921 passed.
  • Open standards: Markdown with YAML front matter and [[wiki links]], which Obsidian and most notes apps read.
  • Refine later: include the files attached to notes in the zip, and import a Markdown folder back. Separately, an entity merge and its Undo don't account for mentions that analysis adds in between: those stay on the kept entity, and here the graph lost both entities. That deserves its own fix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RrY2byt5BHVeBXJUyfwWpb

A note's ⋯ menu in the tree has Download as Markdown, and the Notes page's ⋯
menu downloads every page of the namespace as a zip of Markdown files in
folders that follow the tree, for Obsidian and other notes apps. Each file has
front matter (title, date, filing, summary) and links to other notes as
[[Title]] wiki links. GET /api/v1/notes/{pid}/markdown and
GET /api/v1/notes/export?ns= give agents the same files.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RrY2byt5BHVeBXJUyfwWpb
@adeelahmad adeelahmad self-assigned this Oct 15, 2026
…e does

On a slow runner import-file's pi-episode was still being read (40s in
Chromium) when entity-merge ran; its mentions of Lens and Raspberry Pi
landed between the merge and its Undo, and graph-merge then found neither in
the graph (Clicks and keystrokes per feature on #419).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RrY2byt5BHVeBXJUyfwWpb
adeelahmad added a commit that referenced this pull request Oct 15, 2026
…pages and notes as built (#424)

Move usage analytics (#274) and assets and people (#273) out of the
README's In progress list, and add what merged since #383: a namespace's
own MCP server, chat completions and one-namespace API keys; editing and
merging entities and topics with undo, from agents too; entity pages at
wiki addresses; Connect with Google and rclone sign-in on the server;
the notes tree, today's note, pins, search and Recently deleted; backups
that keep Lens's files; and grouped, searchable settings. In progress now
lists the open feature PRs (#398, #400, #402, #408, #419), and the docs
index links usage analytics.


Claude-Session: https://claude.ai/code/session_01HDx7PPUauyjMn1LZs8JAsS

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
@adeelahmad
adeelahmad merged commit 6c1413e into main Oct 17, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-wm7xc9 branch October 17, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0