DEVONthink
DEVONthink 是 macOS 上的文档和信息管理工具。Protocol Launcher 可以根据 DEVONthink 官方帮助文档生成两类链接:URL commands(x-devonthink://)和 item links(x-devonthink-item://)。
使用
提供两种使用方式:
- 按需加载(通过子路径导入),支持 Tree Shaking,体积更小。
- 全量导入(从根包导入),使用简单,但会包含所有应用模块。
生产环境建议使用按需加载以减小体积;快速脚本或演示可选择全量导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
URL Commands
DEVONthink URL commands 使用 x-devonthink://<command> scheme。它们是命令 URL,不是 x-callback-url。
创建格式化笔记
ts
import { createFormattedNote } from 'protocol-launcher/devonthink'
const url = createFormattedNote({
title: 'New Note',
source: '<p>Hello</p>',
})创建 HTML
ts
import { createHTML } from 'protocol-launcher/devonthink'
const url = createHTML({
title: 'Page',
source: '<h1>Hello</h1>',
})创建 Markdown
ts
import { createMarkdown } from 'protocol-launcher/devonthink'
const url = createMarkdown({
title: 'Readme',
text: '# Hello',
})创建 PDF
ts
import { createPDF } from 'protocol-launcher/devonthink'
const url = createPDF({
location: 'https://www.devontechnologies.com',
width: 800,
paginated: 1,
})创建 RTF
ts
import { createRTF } from 'protocol-launcher/devonthink'
const url = createRTF({
title: 'New bookmark',
location: 'http://www.devontechnologies.com',
noselector: 1,
})
const url = createRTF({
title: 'Selection',
selection: 'Selected text',
})创建网页归档
ts
import { createWebArchive } from 'protocol-launcher/devonthink'
const url = createWebArchive({
title: 'DEVONtechnologies',
location: 'https://www.devontechnologies.com',
})创建书签
ts
import { createBookmark } from 'protocol-launcher/devonthink'
const url = createBookmark({
title: 'DEVONtechnologies',
location: 'https://www.devontechnologies.com',
})创建组
ts
import { createGroup } from 'protocol-launcher/devonthink'
const url = createGroup({
title: 'Inbox',
destination: 'F8E2A5A6-0000-0000-0000-000000000000',
})创建文本
ts
import { createText } from 'protocol-launcher/devonthink'
const url = createText({
title: 'Plain Note',
text: 'Hello World',
})Clip
打开 Clip to DEVONthink 面板。
ts
import { clip } from 'protocol-launcher/devonthink'
const url = clip()Note
打开 Take Note 面板。
ts
import { note } from 'protocol-launcher/devonthink'
const url = note()搜索
在已打开的 DEVONthink 数据库中发起搜索。
ts
import { search } from 'protocol-launcher/devonthink'
const url = search({
query: 'invoice',
})Item Links
DEVONthink item links 使用 x-devonthink-item://<uuid> scheme。它们指向已有的 DEVONthink 数据库、组、文档,或受支持文档里的具体位置。
Item Link
ts
import { itemLink } from 'protocol-launcher/devonthink'
const url = itemLink({
uuid: '929D101B-35AC-474C-801C-D8818C48DB80',
reveal: 1,
})
const url = itemLink({
uuid: 'PDF-ID',
page: 5,
})
const url = itemLink({
uuid: 'TEXT-FILE-ID',
search: 'iPad Pro',
})
const url = itemLink({
uuid: 'MOVIE-ID',
time: 43.5,
})
const url = itemLink({
uuid: '929D101B-35AC-474C-801C-D8818C48DB80',
line: 125,
})