notesmd

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

NotesMD CLI

NotesMD CLI

Interact with Obsidian vaults using
notesmd-cli
. Works without Obsidian running — operates directly on the vault's Markdown files.
使用
notesmd-cli
与Obsidian库交互。无需运行Obsidian即可工作——直接操作库中的Markdown文件。

Vault basics

库基础

Obsidian vault = a normal folder on disk containing
*.md
files.
Vault config lives at
~/Library/Application Support/obsidian/obsidian.json
on macOS.
Obsidian库 = 磁盘上包含
*.md
文件的普通文件夹。
在macOS上,库配置文件位于
~/Library/Application Support/obsidian/obsidian.json

Setup

配置

Set default vault (once):
bash
notesmd-cli set-default "{vault-name}"
Check current default:
bash
notesmd-cli print-default
notesmd-cli print-default --path-only
All commands accept
--vault "{vault-name}"
to target a specific vault.
设置默认库(仅需一次):
bash
notesmd-cli set-default "{vault-name}"
查看当前默认库:
bash
notesmd-cli print-default
notesmd-cli print-default --path-only
所有命令都支持通过
--vault "{vault-name}"
指定目标库。

Commands

命令

Read

读取

bash
notesmd-cli print "{note-name-or-path}"
notesmd-cli list                          # vault root
notesmd-cli list "subfolder"
bash
notesmd-cli print "{note-name-or-path}"
notesmd-cli list                          # 库根目录
notesmd-cli list "subfolder"

Search

搜索

bash
notesmd-cli search                        # fuzzy search note names
notesmd-cli search-content "term"         # search inside note content
Add
--editor
to open selected note in
$EDITOR
instead of Obsidian.
bash
notesmd-cli search                        # 模糊搜索笔记名称
notesmd-cli search-content "term"         # 在笔记内容中搜索
添加
--editor
参数可在
$EDITOR
中打开选中的笔记,而非Obsidian。

Create / Update

创建/更新

bash
notesmd-cli create "{note-name}" --content "..."
notesmd-cli create "{note-name}" --content "..." --overwrite   # replace existing
notesmd-cli create "{note-name}" --content "..." --append      # append to existing
notesmd-cli create "{note-name}" --open                        # open after create
bash
notesmd-cli create "{note-name}" --content "..."
notesmd-cli create "{note-name}" --content "..." --overwrite   # 替换已有笔记
notesmd-cli create "{note-name}" --content "..." --append      # 追加到已有笔记
notesmd-cli create "{note-name}" --open                        # 创建后打开

Move / Rename

移动/重命名

Updates
[[wikilinks]]
across the vault automatically.
bash
notesmd-cli move "{old-path}" "{new-path}"
自动更新整个库中的
[[wikilinks]]
链接。
bash
notesmd-cli move "{old-path}" "{new-path}"

Delete

删除

bash
notesmd-cli delete "{note-path}"
bash
notesmd-cli delete "{note-path}"

Daily note

每日笔记

bash
notesmd-cli daily
bash
notesmd-cli daily

Open in Obsidian

在Obsidian中打开

bash
notesmd-cli open "{note-name}"
notesmd-cli open "{note-name}" --section "{heading}"
bash
notesmd-cli open "{note-name}"
notesmd-cli open "{note-name}" --section "{heading}"

Frontmatter

Frontmatter管理

bash
notesmd-cli frontmatter "{note}" --print
notesmd-cli frontmatter "{note}" --edit --key "status" --value "done"
notesmd-cli frontmatter "{note}" --delete --key "draft"
bash
notesmd-cli frontmatter "{note}" --print
notesmd-cli frontmatter "{note}" --edit --key "status" --value "done"
notesmd-cli frontmatter "{note}" --delete --key "draft"

Tips

小贴士

  • Note paths are relative to vault root (e.g.
    "Folder/Note"
    )
  • For direct edits, modify the
    .md
    file directly — Obsidian picks up changes
  • Prefer
    notesmd-cli move
    over
    mv
    to keep wikilinks consistent
  • --editor
    flag uses
    $EDITOR
    env var (defaults to
    vim
    )
  • For CLI bugs or unexpected behavior, refer to notesmd-cli
  • 笔记路径相对于库根目录(例如
    "Folder/Note"
  • 如需直接编辑,可修改
    .md
    文件——Obsidian会自动识别更改
  • 优先使用
    notesmd-cli move
    而非
    mv
    命令,以保持wikilinks链接一致
  • --editor
    参数使用
    $EDITOR
    环境变量(默认为
    vim
  • 若遇到CLI工具的bug或异常行为,请参考notesmd-cli