Show HN:Ledge.sh——可运行的 Markdown 笔记
Show HN: Ledge.sh – Runnable Markdown Notes

原始链接: https://ledge.sh

Ledge 是一款 Markdown 笔记应用,可将文件夹转换为支持代码和实时运行的工作区。Python、Node、Ruby 和 PHP 可直接使用,TypeScript 通过内置的 Bun 运行,Redis 和 SQL 代码块则可使用环境 URL 连接;还可以在“设置”中添加更多解释器。 每日笔记基于普通 Markdown 模板创建,并通过日期和提示词区块快速生成晨间简报。你可以附加项目文件夹,而无需移动或修改其中的文件;还可以切换最多九个工作区,每个工作区都有独立的布局。 编辑功能包括语法感知的实时预览、从网页和文档导入内容时的富文本粘贴转换、图片处理,以及锁定笔记的可选加密。双向链接、全文搜索、反向链接、大纲、标签和收藏功能让笔记易于浏览和查找。 `ledge` CLI 可在任何终端中列出、读取、搜索、创建和追加笔记,输出清晰,并支持 JSON 格式输出。应用会随 CLI 的更改实时同步更新。删除的笔记会移至废纸篓,并在其中保留 30 天;永久删除时需要确认。

Ledge.sh 是一款开源的 Markdown 笔记本,可以在笔记中直接运行 Shell 命令、代码、SQL 和其他内容。它提供真正的交互式 Shell,支持本地使用,也可通过 SSH 远程使用,并可在 macOS、Linux、配备 WSL 的 Windows、iOS 和 Android 上运行。该项目基于 Bun 和 Electrobun 构建,Android 版本仍处于测试阶段。 它在 Hacker News 上获得了非常积极的反响。用户将其与 Org-Babel、Jupyter、Atuin Desktop 和“可执行文档”进行比较。创建者强调,其主要区别在于采用 Markdown 格式、配备交互式终端、无需依赖 Emacs,以及支持移动设备。 讨论主要围绕类似工具为何难以普及:可执行文档难以编写和维护,内容可能因系统不同而逐渐过时,也不一定适合团队规模化使用。用户建议增加编辑器自动补全,并更明确地将产品定位为“可运行的 Markdown 笔记”,而不是“可以运行代码的笔记本”,以避免一些读者将其与 Jupyter 混淆。未来,智能代理或许能够协助生成、更新和审查这类文档。
相关文章

原文

Your languages

Python, Node, Ruby, and PHP run out of the box. A redis block feeds redis-cli, pointed at staging or prod by the note's REDIS_URL. TypeScript uses the Bun runtime bundled with the app, so ts blocks run with nothing installed. Adding an interpreter is one line in Settings.

"sql": "psql \"$DATABASE_URL\" -f"

Daily notes and templates

⌘J opens today's note, stamped from your daily template. Templates are ordinary notes with {{date}} and {{yesterday}} tokens, and one carrying a prompt block gives every morning a one-keystroke briefing.

promptSummarize [[{{yesterday}}]]

A workspace is a folder

Attach a project folder and its Markdown files become notes where they are, running their blocks in the project. ⌘1 to ⌘9 switch workspaces, and each keeps its own pane layout. Removing an attached folder from Ledge touches no files.

Attach Folder as Workspace…

Live preview

Syntax hides away from the caret: **bold** shows bold, links show their label, tables and images render in place, and a checkbox is clickable. Move the caret in and the exact characters come back. One setting shows every character all the time.

"editor.livePreview": false

Paste anything

Copy part of a web page, a Slack thread, or a Google Doc, and ⌘V pastes it as Markdown: headings, lists, checkboxes, links, and tables included. ⇧⌘V pastes the plain text. An image on the pasteboard lands in the workspace as a file, rendering in place; pasted into a locked note, it is encrypted from the first byte.

![](.ledge-assets/pasted-2026-07-31.png)

Find your way back

⌘P opens a note by title; type # for full-text search. Wikilinks address titles, so a retitle never leaves a stale link. Backlinks and outline each get a panel.

[[Oncall handbook#Paging]]

Tags and favorites

Tag a note with inline #hashtags or a frontmatter tags: line, and ⌥⌘T lists every tag with its count. Press f on a note's row, or click its star, and it sits in a Favorites section at the top of the sidebar, however deep in a folder it lives. Both are frontmatter, so they travel with the file.

favorite: true

Deleting is undoable

⌫ moves a note to the workspace trash and shows an Undo strip. The Trash section in the sidebar holds it for 30 days, where r restores it and permanent deletion asks first.

"trash.ttlDays": 30

The ledge CLI

Lists, reads, searches, creates, and appends from any terminal, and the app follows along live. Results go to stdout, everything conversational to stderr, so pipes stay clean, and --json switches any verb to machine-readable output.

git log --oneline -5 | ledge append "Release notes"

联系我们 contact @ memedata.com