银弹:使用 Markdown 和 Lua 构建的个人生产力平台
Silverbullet: Personal productivity platform built with Markdown and Lua

原始链接: https://github.com/silverbulletmd/silverbullet

## SilverBullet:强大、自托管的生产力平台 SilverBullet是一个免费、开源的个人生产力平台,基于Markdown构建,并增强了Lua脚本语言。它本质上是一个笔记应用程序,提供简洁、实时预览的Markdown编辑器,具有wiki风格的链接([[页面链接]])和双向链接跟踪。 然而,SilverBullet超越了简单的笔记功能。其“本地优先”PWA架构允许完全离线访问和自动同步,而嵌入的Lua脚本(${lua expression})使用户能够在笔记*内部*构建应用程序——一种“终端用户编程”形式。页面被视为索引的“对象”,允许类似数据库的查询和操作。 主要功能包括自托管以确保数据所有权、键盘中心导航以及通过“插件”进行扩展。SilverBullet使用TypeScript、Go构建,并利用CodeMirror 6和Preact等技术,为个人知识管理和应用程序开发提供灵活强大的环境。它可以本地使用Deno和Go运行,或通过Docker运行。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Silverbullet: 使用 Markdown 和 Lua 构建的个人生产力平台 (github.com/silverbulletmd) 4 点赞 nateb2022 1 小时前 | 隐藏 | 过去 | 收藏 | 讨论 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系方式 搜索:
相关文章

原文

SilverBullet is an open source personal productivity platform built on Markdown, turbo charged with the scripting power of Lua. You self host it on your server, access it via any modern browser on any device (desktop, laptop, mobile). Since SilverBullet is built as a Local First PWA, it is fully offline capable. Temporarily don't have network access? No problem, SilverBullet will sync your content when you get back online.

You may start your SilverBullet journey by simply thinking of it as a note taking app. Because, well, it is. You write notes in Markdown and get Live Preview. It looks WYSIWYG while still easily accessing the markdown that lies underneath. You can create Links to other pages, via the [[other page]] syntax. As you navigate your Space (that's what we call a SilverBullet instance) by clicking these links, you will see Linked Mentions to get a feel of how your pages are inter-linked.

Then you learn that in SilverBullet, you can embed Space Lua (SilverBullet's Lua dialect) right into your pages, using the special ${lua expression} syntax. You try something simple, like ${10 + 2}. Ok, that's cool. As you learn more, you start tagging pages and adding Frontmatter. As it turns out, pages (and other things) are indexed as Objects. You realize you can query these objects like a database.

Imagine the possibilities. Before you know it — you realize you're effectively building applications in your notes app. End-User Programming, y'all. It's cool.

You may have been told there is no such thing as a silver bullet.

You were told wrong.

Introduction to SilverBullet

SilverBullet...

  • At its core is a note taking application, a kind of personal wiki, storing its notes in the universal Markdown format in a folder on your server.
  • Is a web application and therefore accessible from wherever a (modern) web browser is available.
  • Is built as a Local First PWA keeping a copy of your content in your browser's local database, syncing back to the server when a network connection is available, enabling 100% offline operation.
  • Provides an enjoyable Markdown writing experience with a clean UI, rendering text using Live Preview, further reducing visual noise while still providing direct access to the underlying markdown syntax.
  • Supports wiki-style page linking using the [[page link]] syntax. Incoming links are indexed and appear as Linked Mentions at the bottom of the pages linked to thereby providing bi-directional linking.
  • Is optimized for keyboard-based operation:
    • Quickly navigate between pages using the page switcher (triggered with Cmd-k on Mac or Ctrl-k on Linux and Windows).
    • Run commands via their keyboard shortcuts or the command palette (triggered with Cmd-/ or Ctrl-/ on Linux and Windows).
    • Use Slash Commands to perform common text editing operations.
  • Is a platform for End-User Programming through its support for Objects and Space Lua.
  • Can be extended using Space Lua and Plugs, and a lot of core functionality is built that way.
  • Is self-hosted: you own your data. Your space is stored as plain files in a folder on disk on your server. Back it up, sync, edit, publish, script it with any additional tools you like.
  • Is free, open source, MIT licensed software.

Check out the instructions.

SilverBullet's frontend is written in TypeScript and built on top of the excellent CodeMirror 6 editor component. Additional UI is built using Preact. ESBuild is used to build both the front-end.

The server backend is written in Go.

  • client/: The SilverBullet client, implemented with TypeScript
  • server/: The SilverBullet server, written in Go
  • plugs: Set of built-in plugs that are distributed with SilverBullet
  • libraries: A set of libraries (space scripts, page templates, slash templates) distributed with SilverBullet
  • plug-api/: Useful APIs for use in plugs
    • lib/: Useful libraries to be used in plugs
    • syscalls/: TypeScript wrappers around syscalls
    • types/: Various (client) types that can be references from plugs
  • bin
    • plug_compile.ts the plug compiler
  • scripts/: Useful scripts
  • website/: silverbullet.md website content
  • Deno: Used to build the frontend and plugs
  • Go: Used to build the backend

It's convenient to also install air for development, this will automatically rebuild both the frontend and backend when changes are made:

go install github.com/air-verse/air@latest

Make sure your $GOPATH/bin is in your $PATH.

To build everything and run the server:

Alternatively, to build:

To run the resulting server:

./silverbullet <PATH-TO-YOUR-SPACE>
# Clean all generated files
make clean
# Typecheck and lint all code
make check
# Format all code
make fmt
# Run all tests
make test

Note, you do not need Deno nor Go locally installed for this to work:

docker build -t silverbullet .

To run:

docker run -p 3000:3000 -v <PATH-TO-YOUR-SPACE>:/space silverbullet
联系我们 contact @ memedata.com