English | 简体中文
A lightweight text / code / Markdown sharing service built on Cloudflare Workers + KV. Save a note by key, then read it back as plain text, raw HTML, a rendered Markdown page, or a syntax-highlighted Gist view.
Live demo: https://note.linkof.link
- One key, four views — the same note is available as source,
.html,.md, and.gist. - Rendered Markdown — GitHub-style page via
marked, sanitized withDOMPurify, code highlighted byhighlight.js. - Gist view — read-only code viewer with automatic language detection, line numbers, and a copy button.
- China-friendly CDN — visitors from CN are automatically served assets from a jsDelivr mirror (
cdn.jsdmirror.com). - Zero server — runs entirely on Cloudflare's edge, notes live in a KV namespace.
| Method | Path | Description |
|---|---|---|
GET |
/ |
Redirects to the static web UI. |
POST |
/set |
Save a note. Body: { "key": "...", "value": "..." } (JSON or form). Returns links to all views. |
GET |
/<key> |
Raw note content. |
GET |
/<key>.html |
Renders the note as raw HTML. |
GET |
/<key>.md |
Renders the note as a Markdown page. |
GET |
/<key>.gist |
Renders the note as a highlighted code view. |
GET |
/list?passwd=<secret> |
Lists all note keys. Requires the LIST_PASSWD secret. |
curl -X POST https://note.linkof.link/set \
-H "Content-Type: application/json" \
-d '{"key":"hello","value":"# Hello\n\nsome **markdown**"}'Then open any of:
https://note.linkof.link/hello— raw texthttps://note.linkof.link/hello.md— Markdown pagehttps://note.linkof.link/hello.gist— code view
Requires a Cloudflare account and Wrangler.
# 1. Create a KV namespace
npx wrangler kv namespace create NOTE
# 2. Configure wrangler.toml (copy the example and fill in your KV id)
cp wrangler.toml.example wrangler.toml
# 3. Deploy
npx wrangler deployThe /list endpoint is protected by the LIST_PASSWD secret. If it is not set, /list refuses every request (fail-closed). Never hardcode the password in source.
npx wrangler secret put LIST_PASSWD- Notes are readable by anyone who knows the key — treat keys like unlisted URLs, not access control.
/setis unauthenticated by design; put it behind your own auth if you deploy publicly..htmlnotes are rendered as raw HTML with no sanitization — only store HTML you trust.
English | 简体中文
基于 Cloudflare Workers + KV 的轻量文本 / 代码 / Markdown 分享服务。用一个 key 保存笔记,即可以纯文本、原始 HTML、渲染后的 Markdown 页面,或带语法高亮的 Gist 视图读取。
- 一个 key,四种视图 — 同一份笔记支持源文本、
.html、.md、.gist。 - Markdown 渲染 — 用
marked生成 GitHub 风格页面,DOMPurify做净化,highlight.js高亮代码。 - Gist 视图 — 只读代码查看器,自动识别语言、带行号和复制按钮。
- 中国 CDN 友好 — 来自中国大陆的访客自动切换到 jsDelivr 镜像(
cdn.jsdmirror.com)。 - 无需服务器 — 完全跑在 Cloudflare 边缘,笔记存在 KV 里。
| 方法 | 路径 | 说明 |
|---|---|---|
GET |
/ |
跳转到静态前端页面。 |
POST |
/set |
保存笔记。请求体:{ "key": "...", "value": "..." }(JSON 或表单)。返回各视图链接。 |
GET |
/<key> |
笔记原始内容。 |
GET |
/<key>.html |
以原始 HTML 渲染。 |
GET |
/<key>.md |
以 Markdown 页面渲染。 |
GET |
/<key>.gist |
以高亮代码视图渲染。 |
GET |
/list?passwd=<secret> |
列出所有笔记 key,需要 LIST_PASSWD 密钥。 |
curl -X POST https://note.linkof.link/set \
-H "Content-Type: application/json" \
-d '{"key":"hello","value":"# 你好\n\n一些 **Markdown**"}'然后打开任意一个:
https://note.linkof.link/hello— 原始文本https://note.linkof.link/hello.md— Markdown 页面https://note.linkof.link/hello.gist— 代码视图
需要 Cloudflare 账号和 Wrangler。
# 1. 创建 KV namespace
npx wrangler kv namespace create NOTE
# 2. 配置 wrangler.toml(复制示例并填入你的 KV id)
cp wrangler.toml.example wrangler.toml
# 3. 部署
npx wrangler deploy/list 接口由 LIST_PASSWD 密钥保护。若未设置,/list 会拒绝所有请求(fail-closed)。切勿把口令硬编码进源码。
npx wrangler secret put LIST_PASSWD- 知道 key 的人都能读取对应笔记 —— 请把 key 当作「不公开的链接」,而非访问控制。
/set默认无鉴权;若公开部署,请自行在前面加一层认证。.html笔记按原始 HTML 渲染、不做净化 —— 只存放你信任的 HTML。