Lepton

hackjutsuMIT活跃维护 有专家点评

跨平台代码片段管理器,用 GitHub Gist 做云端同步,支持标签分类和 Markdown 编辑,解决零散代码片段散落各处、难以检索复用的问题。

💻 Democratizing Snippet Management (macOS/Win/Linux)

v2.0.0发布于 2026-07-05 22:29 UTC10,347star477fork同步于 2026-11-11 05:28 UTC

专家点评

上手难度:进阶更新于 2026-11-11

把 GitHub Gist 和 GitLab 片段收进本地桌面端,替代浏览器标签页里翻 gist 的工作流

适用场景

  • 日常查片段:写代码时按全局快捷键呼出搜索,比开浏览器、登录、翻 gist 列表少几步;用纯本地文件或 IDE 内置片段库则拿不到跨机器同步。
  • 多账号或多平台片段并存:GitHub 和 GitLab 的片段放在同一个标签/语言分组下检索,换别的工具通常只认一家。
  • 需要渲染的笔记型片段:Markdown 和 Jupyter Notebook 直接在客户端里看,不用为一段笔记开 Jupyter 或预览器。
  • 团队共享公开片段:靠 gist 本身的公开性做分发,客户端只负责组织和检索,不需要自建服务端。

踩坑

  • 从源码构建时门槛集中在认证:必须自建 configs/account.js 填 GitHub OAuth 的 client id/secret,否则登录走不通;只想改点 UI 的人会卡在这一步。
  • 代理环境:issue 里有「Cannot use behind a proxy」被提出,说明企业网络下同步链路可能先撞墙,且 .leptonrc 的代理配置需要提前确认。
  • 功能缺口是反复被提的:搜索只覆盖标题还是正文(有 search gist content 的请求)、离线可用性(offline mode 请求)、深色主题都在 issue 列表里挂着,别指望 README 之外还有隐藏实现。
  • 自动化 smoke 测试不覆盖 OAuth、片段增删改查和同步,升级或自行构建后这些路径只能手动验。

同类对比

如果只需要单机、不依赖 gist 的片段库,直接用编辑器内置 snippets 或纯文本文件更省事;如果核心诉求是跨设备笔记同步而非代码片段,Obsidian 这类基于文件同步的工具分流更合适。

怎么上手

由 README 提炼,执行前请确认
brew install --cask lepton
snap install lepton
硬件要求按 README 说明

README 未说明;作为 Electron 桌面应用,在 macOS、Windows、Linux 上运行,无需 GPU 或显存。

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 Electron 的轻量代码片段管理器,把 GitHub Gist 和 GitLab 片段统一到本地桌面端管理

跨平台代码片段管理器,用 GitHub Gist 做云端同步,支持标签分类和 Markdown 编辑,解决零散代码片段散落各处、难以检索复用的问题。

核心能力

  • 用标签和语言分组组织无限量的公开/私密片段
  • 支持 Markdown 与 Jupyter Notebook 渲染
  • 通过 GitHub token 或 GitLab 个人访问令牌同步片段
  • 内置搜索、仪表盘与沉浸模式,配全局快捷键
  • 用 .leptonrc 自定义主题、编辑器、代理和界面语言

容易踩的坑

从源码构建需 Node.js 24 LTS 与 npm 11.x,且需自建 configs/account.js 填入 GitHub OAuth 的 client id/secret,否则无法真实登录;Linux 构建 snap 包需要运行中的 Docker 守护进程;自动化 smoke 测试不覆盖 GitHub OAuth、片段增删改查与同步等真实后端行为,需手动验证。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v2.0.0
  1. v2.0.1-beta.42.0.1-beta.4pre-release2026-11-02 · 2026-11-02 09:10 UTC
    查看更新说明

    Traceability

  2. v2.0.1-beta.32.0.1-beta.3pre-release2026-10-05 · 2026-10-05 09:16 UTC
    查看更新说明

    Traceability

  3. v2.0.1-beta.22.0.1-beta.2pre-release2026-09-07 · 2026-09-07 09:11 UTC
    查看更新说明

    Changes

    • Editable Settings page (#671)
      Cmd/Ctrl + , opens Settings with Preferences and About tabs. Users can edit .leptonrc options through validated controls, with restart-required settings clearly identified.
    • Find within the current page (#667)
      Cmd/Ctrl + F opens an in-page search bar with highlighted matches, result counts, and active-result navigation.
    • New-snippet draft recovery (#669)
      Failed snippet submissions are saved locally with their description, privacy setting, filenames, and contents. Users can load or discard the timestamped draft.
    • More reliable login persistence (#666)
      Cached GitHub tokens now safely fall back to local storage when Electron secure storage is unavailable.
    • Safer link processing (#660)
      Updated linkify-it from 5.0.1 to 5.0.2 to prevent excessive processing of pathological links.
    • Optimized images (#668)
      Reduced affected application and documentation image sizes by approximately 4.3%.

    Traceability

  4. v2.0.1-beta.12.0.1-beta.1pre-release2026-08-03 · 2026-08-03 10:19 UTC
    查看更新说明

    Changes

    • Improved About-page scrollbars (#659)
      Applied Lepton’s subdued scrollbar styling to contributor, license, and path sections in the About modal.

    Traceability

  5. v2.0.02.0.0最新正式版2026-07-05 · 2026-07-05 22:29 UTC

    Substantial foundation upgrades

    New features

    To enable full content download in .leptonrc.

    Supported values in .leptonrc's theme : light, dark, one-dark, atom-one-dark, github-light, github-dark, catppuccin-latte, catppuccin-mocha, solarized-light, solarized-dark, dracula, material-theme, ayu

    Example: dracula

    Platforms

    macOS

    Notice: I do not have a paid Apple developer account to sign the app. Pls enable Lepton in the security settings preference to install the app.

    • Lepton-2.x.x-xxx-mac-arm64.dmg
    • Lepton-2.x.x-xxx-mac-x64.dmg

    Windows

    • Lepton-2.x.x-xxx-win-ia32.exe
    • Lepton-2.x.x-xxx-win-x64.exe

    Linux

    sudo snap install lepton # to install th e released version
    sudo snap install lepton --edge # to install the beta version
    sudo snap refresh lepton --edge # to update to the latest beta version if lepton was installed
    

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    All Contributors MIT Licensed lepton

    Star History Rank

    Lepton is a lean code snippet manager for GitHub Gist and GitLab personal snippets. Check out the latest release.

    Features

    • Unlimited public/secret snippets
    • Unlimited tags
    • Language groups
    • Markdown/JupyterNotebook
    • GitHub Enterprise
    • GitHub token
    • GitLab.com and self-managed GitLab personal snippets (personal access token)
    • Immersive mode
    • Customizable
    • Built-in themes
    • macOS/Win/Linux
    • Dashboard
    • Search snippets
    • Proxy
    • Free

    Screenshot

    Light ThemeDark Theme
    ScreenshotScreenshot
    OrganizeMarkdownJupyter Notebook
    ScreenshotScreenshotScreenshot
    Search snippets (⇧ + Space)Immersive Mode (⌘/Ctrl + i)Dashboard (⌘/Ctrl + d)
    ScreenshotScreenshotScreenshot

    Shortcuts

    FunctionShortcutNote
    New SnippetCmd/Ctrl + NCreate a snippet
    Edit SnippetCmd/Ctrl + EEdit a snippet
    Delete SnippetCmd/Ctrl + DelDelete selected snippet
    SubmitCmd/Ctrl + SSubmit the changes from the editor
    SyncCmd/Ctrl + RSync snippets with the selected provider
    Immersive ModeCmd/Ctrl + IToggle the Immersive mode
    DashboardCmd/Ctrl + DToggle the dashboard
    About PageCmd/Ctrl + ,Toggle the About page
    SearchShift + SpaceToggle snippet search

    See the Search FAQ for searchable fields and content-search behavior.

    Customization

    Lepton's can be customized by <home_dir>/.leptonrc! You can find its exact path in the About page by Command/Ctrl + ,. Create the file if it does not exist.

    • Theme (light, dark, one-dark, atom-one-dark, github-light, github-dark, catppuccin-latte, catppuccin-mocha, solarized-light, solarized-dark, dracula, material-theme, or ayu)
    • Snippet
    • Editor
    • Logger
    • Proxy
    • Shortcuts
    • Zoom
    • Snippet provider (github or gitlab)
    • Enterprise
    • Notifications
    • Interface language (i18n.locale: en, es, fr, ja, ko, tr, zh-Hans, or zh-Hant)

    Check out the configuration docs to explore different customization options. Missing a locale? See How do I add a new interface locale?

    Tech Stack

    Based on

    1. Framework: Electron
    2. Bundler: Webpack, Babel, electron-builder
    3. Language: ES6, Sass/SCSS
    4. UI/state: React 19, Redux, React Redux, Redux Thunk
    5. Editor/rendering: CodeMirror, Highlight.js, Markdown/Jupyter rendering
    6. Tests/lint: Vitest, Electron smoke tests, ESLint

    Now you can learn about Lepton project's code structure in DeepWiki!

    Installation

    brew install --cask lepton
    
    snap install lepton
    

    Based on

    Support

    Lepton is a free and open source project. We do not accept project donations, but if you would like to support the maintainer, you can buy me a coffee.

    We also recommend donating to Wikimedia Foundation, which helps sustain free knowledge through Wikipedia and its sister projects.

    Development

    Runtime requirements

    Lepton's current development toolchain is known to work with Node.js 24 LTS and npm 11.x. This is the host runtime used to install dependencies and run the webpack build; the bundled Electron app runtime is managed by the Electron version in package.json.

    Recommended:

    • Node.js 24.18.0
    • npm 11.16.x

    If you use nvm, the repository includes an .nvmrc:

    $ nvm install
    $ nvm use
    

    Apple Silicon development should use the native arm64 Node.js runtime.

    Install dependencies

    $ git clone https://github.com/hackjutsu/Lepton.git
    $ cd Lepton
    $ npm ci
    
    # inspect stale dependencies
    $ npm run check-outdated
    

    Client ID/Secret

    Register your application, and put your client id and client secret in ./configs/account.js.

    module.exports = {
      client_id: <your_client_id>,
      client_secret: <your_client_secret>
    }
    

    configs/account.js is intentionally ignored by Git. If it is missing, the app falls back to configs/accountDummy.js, which is useful for rendering tests but will not support real GitHub login. Release builds create configs/account.js from GitHub Actions secrets before packaging.

    Run

    $ npm run build && npm start
    

    For iterative renderer work, run webpack in watch mode in one terminal and restart Electron from another terminal when needed:

    $ npm run webpack-watch
    $ npm start
    

    Build

    # Development bundle
    $ npm run build
    
    # Production bundle
    $ npm run webpack-prod
    

    Automated Validation

    Use these commands before opening a pull request:

    # Lint application source
    $ npm run lint
    
    # Normal local check: Vitest unit tests plus webpack development build
    $ npm test
    
    # Unit tests only
    $ npm run test:unit
    
    # Unit tests in watch mode
    $ npm run test:unit:watch
    

    The project also has Electron smoke checks. These are useful for Electron, React, layout, preload, or packaging changes, and are run by CI.

    # Launches Electron with isolated config/user-data and verifies login plus
    # fixture-backed authenticated renderer surfaces
    $ npm run test:smoke
    
    # Builds an unpacked app and verifies the packaged app can render the login UI.
    # This is primarily for macOS CI or release verification.
    $ npm run test:packaged-smoke
    

    Renderer smoke fixtures are opt-in through the smoke runner and use deterministic mock state to check initial rendering. Fixture names include active, edit, new, about, dashboard, search, delete, raw, pinned-tags, and immersive.

    # Launch one fixture directly when debugging the automated smoke check
    $ npm run build
    $ LEPTON_RENDER_FIXTURE=active npm start
    

    Fixtures verify that important React surfaces mount without renderer warnings, errors, failed loads, or crashes. They do not verify GitHub OAuth, snippet CRUD, sync behavior, real API responses, OS shortcut delivery, or full interaction flows.

    GitHub Actions currently runs:

    • lint-test-build: lint, unit tests, and webpack build verification
    • electron-smoke: Electron renderer smoke test
    • packaged-smoke: packaged app smoke test
    • release: tag-driven cross-platform packaging and publishing

    The smoke jobs are currently configured as non-blocking CI checks while the cross-platform Electron validation continues to mature.

    Manual Verification

    For UI or Electron changes, also launch the app locally:

    $ npm run build && npm start
    

    Confirm the login page visibly renders. After login, manually verify the surfaces affected by your change, such as new snippet, edit snippet, settings/about, dashboard, search, sync, and GitHub Gist backend interactions. Manual verification is still required for visual quality and real GitHub behavior; automated smoke checks do not replace backend workflow testing.

    Local Packaging

    Build an unpacked app for the current platform.

    $ npm run pack
    

    Build apps for macOS.

    $ npm run dist -- -m
    

    Build apps for Windows.

    $ npm run dist -- -w
    

    Build apps for Linux.

    Need a running Docker daemon to build a snap package.

    $ npm run dist -- -l
    

    Build apps for macOS, Windows and Linux.

    $ npm run dist -- -wml
    

    Build apps for the current OS with the current arch.

    $ npm run dist
    

    FAQ

    --> Wiki FAQ

    Contributors

    License

    MIT © hackjutsu