Skip to content

NotePlan

NotePlan 将笔记、日历笔记和任务结合在一起。Protocol Launcher 可以为 NotePlan 官方 URL scheme 文档中列出的 x-callback-url 动作生成链接。

使用

提供两种使用方式:

  • 按需加载(通过子路径导入),支持 Tree Shaking,体积更小。
  • 全量导入(从根包导入),使用简单,但会包含所有应用模块。

生产环境建议使用按需加载以减小体积;快速脚本或演示可选择全量导入。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

打开笔记

打开日历笔记、普通笔记或指定文件名的笔记。

On-Demand
ts
import { openNote } from 'protocol-launcher/noteplan'

const url = openNote({
  noteDate: 'today',
})

const url = openNote({
  noteTitle: 'Fleeting Notes#Second Brain',
})

const url = openNote({
  filename: 'folder/note.txt',
  heading: 'Ideas',
  splitView: 'yes',
})

打开视图

按名称和/或文件夹打开视图。

On-Demand
ts
import { openView } from 'protocol-launcher/noteplan'

const url = openView({
  name: 'Project Tasks',
  folder: '10 - Projects',
})

添加文本

向通过日期、标题或文件名识别的笔记添加文本。

On-Demand
ts
import { addText } from 'protocol-launcher/noteplan'

const url = addText({
  noteDate: 'today',
  text: '* Hello World',
  mode: 'append',
  openNote: 'yes',
})

const url = addText({
  noteTitle: 'Test Note',
  text: '* Hello World',
  mode: 'prepend',
})

添加笔记

用标题和/或文本创建普通笔记。

On-Demand
ts
import { addNote } from 'protocol-launcher/noteplan'

const url = addNote({
  noteTitle: 'New Note',
  openNote: 'yes',
})

const url = addNote({
  text: 'Hello World',
  folder: 'Projects',
  highlightStart: 9999,
  highlightLength: 0,
})

删除笔记

生成一个按标题、日期或文件名删除笔记的 URL。

On-Demand
ts
import { deleteNote } from 'protocol-launcher/noteplan'

const url = deleteNote({
  noteTitle: 'New Note',
})

const url = deleteNote({
  noteDate: 'tomorrow',
})

选择标签

选择标签或提及。选择标签时包含开头的 #@;传入空字符串会显示所有笔记。

On-Demand
ts
import { selectTag } from 'protocol-launcher/noteplan'

const url = selectTag({
  name: '#noteplan',
})

const url = selectTag({
  name: '',
})

搜索

按文本搜索,或打开已有筛选器。

On-Demand
ts
import { search } from 'protocol-launcher/noteplan'

const url = search({
  text: 'noteplan',
})

const url = search({
  filter: 'Upcoming',
})

运行插件

通过插件名称或插件 ID 运行 NotePlan 插件命令。

On-Demand
ts
import { runPlugin } from 'protocol-launcher/noteplan'

const url = runPlugin({
  pluginName: ' Note Statistics',
  command: 'nc',
})

const url = runPlugin({
  pluginID: 'example.Plugin',
  command: 'run',
  arg0: 'first',
  arg1: 'second',
})

安装插件

生成通过插件 ID 安装 NotePlan 插件的 URL。

On-Demand
ts
import { installPlugin } from 'protocol-launcher/noteplan'

const url = installPlugin({
  pluginID: 'dwertheimer.Favorites',
})

切换侧边栏

切换、显示或隐藏侧边栏。

On-Demand
ts
import { toggleSidebar } from 'protocol-launcher/noteplan'

const url = toggleSidebar()

const url = toggleSidebar({
  forceOpen: 'yes',
})

const url = toggleSidebar({
  forceCollapse: 'yes',
  animated: 'no',
})

笔记信息

通过 x-success 请求当前打开笔记的绝对文件路径和名称。

On-Demand
ts
import { noteInfo } from 'protocol-launcher/noteplan'

const url = noteInfo({
  xSuccess: 'sourceapp://x-callback-url',
})

x-success

NotePlan 官方文档列出的每个 x-callback-url 动作都支持 xSuccess

On-Demand
ts
import { addText } from 'protocol-launcher/noteplan'

const url = addText({
  noteDate: 'today',
  text: 'Hello',
  xSuccess: 'sourceapp://x-callback-url',
})

官方参考