obsidian

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Obsidian Knowledge Management Skill

Obsidian知识管理技能

Master Obsidian for building a personal knowledge management system with markdown-based notes, bidirectional linking, powerful plugins, and flexible sync strategies. This skill covers vault organization, linking strategies, plugin ecosystem, and backup workflows.
掌握Obsidian,打造基于Markdown笔记、双向链接、强大插件和灵活同步策略的个人知识管理系统。本技能涵盖库组织、链接策略、插件生态系统和备份工作流。

When to Use This Skill

何时使用本技能

USE Obsidian when:

适合使用Obsidian的场景:

  • Building a personal knowledge base or second brain
  • Implementing Zettelkasten or evergreen note systems
  • Need local-first, privacy-focused note-taking
  • Want full control over your data (plain markdown files)
  • Creating interlinked notes with graph visualization
  • Writing with markdown and want powerful editing
  • Need offline access to all your notes
  • Building project documentation alongside code
  • Journaling with daily notes and templates
  • 搭建个人知识库或第二大脑
  • 实现Zettelkasten(卡片盒笔记法)或常青笔记系统
  • 需要本地优先、注重隐私的笔记记录
  • 希望完全掌控自己的数据(纯Markdown文件)
  • 创建支持图谱可视化的互联笔记
  • 使用Markdown写作并需要强大编辑功能
  • 需要离线访问所有笔记
  • 编写项目文档并与代码关联
  • 使用每日笔记和模板进行日志记录

DON'T USE Obsidian when:

不适合使用Obsidian的场景:

  • Need real-time collaboration (use Notion, Google Docs)
  • Require database-style structured data (use Notion)
  • Need web-based access without sync setup
  • Team-wide knowledge base with permissions (use Confluence)
  • Simple note-taking without linking (use Apple Notes, Bear)
  • Need built-in task management with reminders (use Todoist)
  • 需要实时协作(推荐使用Notion、Google Docs)
  • 需要数据库式结构化数据(推荐使用Notion)
  • 无需同步设置即可实现网页端访问
  • 带权限管理的团队知识库(推荐使用Confluence)
  • 无需链接功能的简单笔记记录(推荐使用Apple Notes、Bear)
  • 需要内置任务管理和提醒功能(推荐使用Todoist)

Prerequisites

前置准备

Installation

安装步骤

bash
undefined
bash
undefined

Download from official site

从官方网站下载

macOS via Homebrew

macOS通过Homebrew安装

brew install --cask obsidian
brew install --cask obsidian

Linux (AppImage)

Linux(AppImage格式)

wget https://github.com/obsidianmd/obsidian-releases/releases/download/v1.5.3/Obsidian-1.5.3.AppImage chmod +x Obsidian-1.5.3.AppImage ./Obsidian-1.5.3.AppImage
wget https://github.com/obsidianmd/obsidian-releases/releases/download/v1.5.3/Obsidian-1.5.3.AppImage chmod +x Obsidian-1.5.3.AppImage ./Obsidian-1.5.3.AppImage

Linux (Flatpak)

Linux(Flatpak格式)

flatpak install flathub md.obsidian.Obsidian
flatpak install flathub md.obsidian.Obsidian

Linux (Snap)

Linux(Snap格式)

sudo snap install obsidian --classic
undefined
sudo snap install obsidian --classic
undefined

Create Your First Vault

创建你的第一个Obsidian库

bash
undefined
bash
undefined

Create vault directory

创建库目录

mkdir -p ~/Documents/ObsidianVault
mkdir -p ~/Documents/ObsidianVault

Initialize vault structure

初始化库结构

cd ~/Documents/ObsidianVault mkdir -p "Daily Notes" "Templates" "Inbox" "Projects" "Areas" "Resources" "Archive"
cd ~/Documents/ObsidianVault mkdir -p "Daily Notes" "Templates" "Inbox" "Projects" "Areas" "Resources" "Archive"

Create initial configuration

创建初始配置

mkdir -p .obsidian cat > .obsidian/app.json << 'EOF' { "alwaysUpdateLinks": true, "newFileLocation": "folder", "newFileFolderPath": "Inbox", "attachmentFolderPath": "Attachments", "showUnsupportedFiles": false, "defaultViewMode": "source" } EOF
mkdir -p .obsidian cat > .obsidian/app.json << 'EOF' { "alwaysUpdateLinks": true, "newFileLocation": "folder", "newFileFolderPath": "Inbox", "attachmentFolderPath": "Attachments", "showUnsupportedFiles": false, "defaultViewMode": "source" } EOF

Create .gitignore for vault

为库创建.gitignore文件

cat > .gitignore << 'EOF' .obsidian/workspace.json .obsidian/workspace-mobile.json .obsidian/plugins/*/data.json .trash/ .sync-conflict- EOF
undefined
cat > .gitignore << 'EOF' .obsidian/workspace.json .obsidian/workspace-mobile.json .obsidian/plugins/*/data.json .trash/ .sync-conflict- EOF
undefined

Verify Setup

验证安装

bash
undefined
bash
undefined

Check vault structure

检查库结构

tree -L 2 ~/Documents/ObsidianVault
tree -L 2 ~/Documents/ObsidianVault

Expected output:

预期输出:

ObsidianVault/

ObsidianVault/

├── .obsidian/

├── .obsidian/

│ └── app.json

│ └── app.json

├── Archive/

├── Archive/

├── Areas/

├── Areas/

├── Daily Notes/

├── Daily Notes/

├── Inbox/

├── Inbox/

├── Projects/

├── Projects/

├── Resources/

├── Resources/

└── Templates/

└── Templates/

undefined
undefined

Core Capabilities

核心功能

1. Vault Structure and Organization

1. 库结构与组织

PARA Method Structure:
markdown
undefined
PARA方法结构:
markdown
undefined

Vault Organization with PARA Method

基于PARA方法的库组织

Projects/ - Active projects with deadlines

Projects/ - 有截止日期的活跃项目

Areas/ - Ongoing responsibilities

Areas/ - 持续进行的职责领域

Resources/- Reference materials

Resources/- 参考资料

Archive/ - Completed or inactive items

Archive/ - 已完成或停用的项目

Example folder structure:

示例文件夹结构:

ObsidianVault/ ├── Daily Notes/ # Daily journal entries ├── Inbox/ # Quick capture, process later ├── Projects/ │ ├── Project-Alpha/ │ │ ├── Overview.md │ │ ├── Tasks.md │ │ └── Meeting Notes/ │ └── Project-Beta/ ├── Areas/ │ ├── Health/ │ ├── Finance/ │ ├── Career/ │ └── Learning/ ├── Resources/ │ ├── Books/ │ ├── Courses/ │ ├── Articles/ │ └── Recipes/ ├── Archive/ │ └── 2025-Q1/ ├── Templates/ │ ├── Daily Note.md │ ├── Meeting Note.md │ ├── Project.md │ └── Book Note.md └── Attachments/ └── images/

**Zettelkasten Structure:**
```markdown
ObsidianVault/ ├── Daily Notes/ # 每日日志条目 ├── Inbox/ # 快速捕获内容,后续处理 ├── Projects/ │ ├── Project-Alpha/ │ │ ├── Overview.md │ │ ├── Tasks.md │ │ └── Meeting Notes/ │ └── Project-Beta/ ├── Areas/ │ ├── Health/ │ ├── Finance/ │ ├── Career/ │ └── Learning/ ├── Resources/ │ ├── Books/ │ ├── Courses/ │ ├── Articles/ │ └── Recipes/ ├── Archive/ │ └── 2025-Q1/ ├── Templates/ │ ├── Daily Note.md │ ├── Meeting Note.md │ ├── Project.md │ └── Book Note.md └── Attachments/ └── images/

**Zettelkasten结构:**
```markdown

Zettelkasten-style vault

Zettelkasten风格的库

ObsidianVault/ ├── 0-Inbox/ # Fleeting notes ├── 1-Literature Notes/ # Notes from sources ├── 2-Permanent Notes/ # Your own ideas ├── 3-Structure Notes/ # MOCs (Maps of Content) ├── 4-Projects/ # Project-specific notes └── Templates/

**Naming Conventions:**
```markdown
ObsidianVault/ ├── 0-Inbox/ # 临时笔记 ├── 1-Literature Notes/ # 来源笔记(摘抄) ├── 2-Permanent Notes/ # 个人原创笔记 ├── 3-Structure Notes/ # MOC(内容地图) ├── 4-Projects/ # 项目专属笔记 └── Templates/

**命名规范:**
```markdown

Date-based naming for daily notes

每日笔记使用日期命名

Daily Notes/2025-01-17.md
Daily Notes/2025-01-17.md

Timestamp-based for Zettelkasten

Zettelkasten使用时间戳命名

202501171430 - Concept Name.md
202501171430 - Concept Name.md

Descriptive naming for permanent notes

永久笔记使用描述性命名

How to Structure a Knowledge Base.md
How to Structure a Knowledge Base.md

Project-prefixed naming

项目笔记使用项目前缀命名

Project-Alpha - Meeting 2025-01-17.md
Project-Alpha - Meeting 2025-01-17.md

Use lowercase with hyphens for consistency

统一使用小写加连字符

my-note-about-something.md
undefined
my-note-about-something.md
undefined

2. Linking and Backlinking

2. 链接与反向链接

Basic Linking:
markdown
undefined
基础链接:
markdown
undefined

Internal links

内部链接

[[Note Name]] [[Note Name|Display Text]] [[Folder/Subfolder/Note Name]]
[[Note Name]] [[Note Name|显示文本]] [[Folder/Subfolder/Note Name]]

Link to heading

链接到标题

[[Note Name#Heading Name]] [[Note Name#Heading Name|Custom Text]]
[[Note Name#Heading Name]] [[Note Name#Heading Name|自定义文本]]

Link to block

链接到块

[[Note Name#^block-id]]
[[Note Name#^block-id]]

Embed notes

嵌入笔记

![[Note Name]] ![[Note Name#Heading]] ![[image.png]] ![[document.pdf]]
![[Note Name]] ![[Note Name#Heading]] ![[image.png]] ![[document.pdf]]

External links

外部链接


**Block References:**
```markdown

**块引用:**
```markdown

In source note (Source Note.md)

在源笔记(Source Note.md)中

This is an important concept. ^important-concept
This paragraph explains something crucial about the topic. It spans multiple lines. ^key-explanation
This is an important concept. ^important-concept
This paragraph explains something crucial about the topic. It spans multiple lines. ^key-explanation

In referencing note

在引用笔记中

As mentioned in [[Source Note#^important-concept]], this concept is key.
As mentioned in [[Source Note#^important-concept]], this concept is key.

Embed the block

嵌入块

![[Source Note#^important-concept]]

**Linking Best Practices:**
```markdown
![[Source Note#^important-concept]]

**链接最佳实践:**
```markdown

Note: The Power of Compound Interest.md

Note: The Power of Compound Interest.md

Summary

Summary

Compound interest is the concept where interest earns interest over time.
Compound interest is the concept where interest earns interest over time.

Related Concepts

Related Concepts

  • [[Time Value of Money]] - foundational concept
  • [[Investment Strategies]] - practical applications
  • [[Rule of 72]] - quick estimation method
  • [[Time Value of Money]] - foundational concept
  • [[Investment Strategies]] - practical applications
  • [[Rule of 72]] - quick estimation method

Sources

Sources

  • [[Book - The Psychology of Money]]
  • [[Article - Warren Buffett on Compounding]]
  • [[Book - The Psychology of Money]]
  • [[Article - Warren Buffett on Compounding]]

Applications

Applications

See [[Personal Finance MOC#Investment Strategies]] for implementation.
See [[Personal Finance MOC#Investment Strategies]] for implementation.

Tags

Tags

#finance #investing #concepts

**Alias Usage:**
```yaml
---
aliases: [PKM, Knowledge Management, KM]
---
#finance #investing #concepts

**别名用法:**
```yaml
---
aliases: [PKM, Knowledge Management, KM]
---

Personal Knowledge Management

Personal Knowledge Management

This note can now be linked via:
  • [[Personal Knowledge Management]]
  • [[PKM]]
  • [[Knowledge Management]]
undefined
This note can now be linked via:
  • [[Personal Knowledge Management]]
  • [[PKM]]
  • [[Knowledge Management]]
undefined

3. Tags and Properties (Frontmatter)

3. 标签与属性(前置元数据)

YAML Frontmatter:
yaml
---
title: Complete Guide to Obsidian
date: 2025-01-17
updated: 2025-01-17
type: reference
status: active
tags:
  - obsidian
  - knowledge-management
  - productivity
author: Your Name
rating: 5
source: https://obsidian.md
related:
  - "[[Markdown Basics]]"
  - "[[Note-Taking Methods]]"
cssclass: wide-page
---
YAML前置元数据:
yaml
---
title: Complete Guide to Obsidian
date: 2025-01-17
updated: 2025-01-17
type: reference
status: active
tags:
  - obsidian
  - knowledge-management
  - productivity
author: Your Name
rating: 5
source: https://obsidian.md
related:
  - "[[Markdown Basics]]"
  - "[[Note-Taking Methods]]"
cssclass: wide-page
---

Complete Guide to Obsidian

Complete Guide to Obsidian

Content starts here...

**Common Property Patterns:**
```yaml
Content starts here...

**常见属性模式:**
```yaml

For book notes

书籍笔记


title: "Book Title" author: "Author Name" type: book status: reading # reading, completed, abandoned started: 2025-01-01 finished: rating: genre: [non-fiction, productivity]


title: "Book Title" author: "Author Name" type: book status: reading # reading, completed, abandoned started: 2025-01-01 finished: rating: genre: [non-fiction, productivity]

For meeting notes

会议笔记


title: Weekly Team Sync type: meeting date: 2025-01-17 attendees:
  • Alice
  • Bob
  • Charlie project: "[[Project Alpha]]" action-items: true


title: Weekly Team Sync type: meeting date: 2025-01-17 attendees:
  • Alice
  • Bob
  • Charlie project: "[[Project Alpha]]" action-items: true

For project notes

项目笔记


title: Project Alpha Overview type: project status: active # planning, active, on-hold, completed start-date: 2025-01-01 due-date: 2025-03-31 priority: high stakeholders:
  • Team Lead
  • Product Manager


**Tag Hierarchies:**
```markdown

title: Project Alpha Overview type: project status: active # planning, active, on-hold, completed start-date: 2025-01-01 due-date: 2025-03-31 priority: high stakeholders:
  • Team Lead
  • Product Manager


**标签层级:**
```markdown

Use nested tags for organization

使用嵌套标签进行组织

#status/active #status/completed #status/on-hold
#type/note #type/literature #type/project
#area/health #area/finance #area/career
#source/book #source/article #source/podcast #source/video
#status/active #status/completed #status/on-hold
#type/note #type/literature #type/project
#area/health #area/finance #area/career
#source/book #source/article #source/podcast #source/video

In a note:

在笔记中使用:

#project/alpha #status/active #priority/high
undefined
#project/alpha #status/active #priority/high
undefined

4. Templates

4. 模板

Daily Note Template:
markdown
---
date: {{date}}
type: daily
tags:
  - daily-note
---
每日笔记模板:
markdown
---
date: {{date}}
type: daily
tags:
  - daily-note
---

{{date:dddd, MMMM D, YYYY}}

{{date:dddd, MMMM D, YYYY}}

Morning Review

晨间回顾

  • Review calendar
  • Check priorities
  • Set daily intention
  • 查看日历
  • 检查优先级
  • 设置每日目标

Today's Focus

今日重点

What is the ONE thing I can do today that will make everything else easier?
今天我能做哪一件事,让其他所有事都变得更简单?

Tasks

任务

Must Do

必须完成

  • [ ]
  • [ ]

Should Do

应该完成

  • [ ]
  • [ ]

Could Do

可以完成

  • [ ]
  • [ ]

Notes & Ideas

笔记与想法

Meetings

会议

dataview
TABLE WITHOUT ID
  file.link as "Meeting",
  attendees as "Attendees"
FROM #meeting
WHERE date = date("{{date:YYYY-MM-DD}}")
dataview
TABLE WITHOUT ID
  file.link as "Meeting",
  attendees as "Attendees"
FROM #meeting
WHERE date = date("{{date:YYYY-MM-DD}}")

Journal

日志

Evening Review

晚间回顾

  • What went well today?
  • What could be improved?
  • What did I learn?

Links: [[{{date:YYYY-MM-DD|yesterday(-1)}}]] | [[{{date:YYYY-MM-DD|tomorrow(+1)}}]]

**Meeting Note Template:**
```markdown
---
title: {{title}}
type: meeting
date: {{date:YYYY-MM-DD}}
time: {{time:HH:mm}}
attendees:
  -
project:
tags:
  - meeting
---
  • 今天哪些事做得好?
  • 哪些地方可以改进?
  • 我学到了什么?

链接: [[{{date:YYYY-MM-DD|yesterday(-1)}}]] | [[{{date:YYYY-MM-DD|tomorrow(+1)}}]]

**会议笔记模板:**
```markdown
---
title: {{title}}
type: meeting
date: {{date:YYYY-MM-DD}}
time: {{time:HH:mm}}
attendees:
  -
project:
tags:
  - meeting
---

{{title}}

{{title}}

Attendees

参会人员

Agenda

议程

Discussion Notes

讨论记录

Decisions Made

达成的决议

Action Items

行动项

  • @Person: Task - Due:
  • @Person: 任务 - 截止日期:

Follow-up

后续跟进

  • Next meeting:
  • Related:

Created: {{date:YYYY-MM-DD HH:mm}}

**Project Template:**
```markdown
---
title: {{title}}
type: project
status: planning
start-date: {{date:YYYY-MM-DD}}
due-date:
priority: medium
tags:
  - project
---
  • 下次会议:
  • 相关链接:

创建时间: {{date:YYYY-MM-DD HH:mm}}

**项目笔记模板:**
```markdown
---
title: {{title}}
type: project
status: planning
start-date: {{date:YYYY-MM-DD}}
due-date:
priority: medium
tags:
  - project
---

{{title}}

{{title}}

Overview

概述

Goal: Success Criteria:
目标: 成功标准:

Status

状态

dataview
TABLE WITHOUT ID
  status as "Status",
  due-date as "Due Date",
  priority as "Priority"
WHERE file.name = this.file.name
dataview
TABLE WITHOUT ID
  status as "Status",
  due-date as "Due Date",
  priority as "Priority"
WHERE file.name = this.file.name

Key Resources

关键资源

Milestones

里程碑

  • Milestone 1 -
  • Milestone 2 -
  • Milestone 3 -
  • 里程碑1 -
  • 里程碑2 -
  • 里程碑3 -

Tasks

任务

In Progress

进行中

dataview
TASK
FROM "Projects/{{title}}"
WHERE !completed AND contains(text, "WIP")
dataview
TASK
FROM "Projects/{{title}}"
WHERE !completed AND contains(text, "WIP")

Pending

待处理

dataview
TASK
FROM "Projects/{{title}}"
WHERE !completed AND !contains(text, "WIP")
dataview
TASK
FROM "Projects/{{title}}"
WHERE !completed AND !contains(text, "WIP")

Notes

笔记

Related

相关链接

  • [[Project MOC]]

Created: {{date:YYYY-MM-DD}}

**Book Note Template:**
```markdown
---
title: "{{title}}"
author:
type: book
status: reading
started: {{date:YYYY-MM-DD}}
finished:
rating:
genre: []
isbn:
tags:
  - book
  - literature-note
---
  • [[Project MOC]]

创建时间: {{date:YYYY-MM-DD}}

**书籍笔记模板:**
```markdown
---
title: "{{title}}"
author:
type: book
status: reading
started: {{date:YYYY-MM-DD}}
finished:
rating:
genre: []
isbn:
tags:
  - book
  - literature-note
---

{{title}}

{{title}}

Book Info

书籍信息

  • Author:
  • Published:
  • Pages:
  • Genre:
  • 作者:
  • 出版时间:
  • 页数:
  • 分类:

Why I Read This

阅读原因

Summary (3 sentences)

摘要(3句话)

Key Ideas

核心观点

Favorite Quotes

最喜欢的引言

Quote here (p. X)
引言内容(第X页)

Chapter Notes

章节笔记

Chapter 1:

第1章:

How This Applies to My Life

对我生活的启发

Related Books

相关书籍

  • [[]]
  • [[]]

Action Items

行动项

  • [ ]

Rating: /5 Would Recommend To:
undefined
  • [ ]

评分: /5 推荐人群:
undefined

5. Dataview Plugin

5. Dataview插件

Installation:
markdown
1. Settings > Community plugins > Turn off Safe mode
2. Browse community plugins > Search "Dataview"
3. Install and Enable
4. Settings > Dataview > Enable JavaScript Queries (optional)
Basic Queries:
markdown
undefined
安装步骤:
markdown
1. 设置 > 社区插件 > 关闭安全模式
2. 浏览社区插件 > 搜索"Dataview"
3. 安装并启用
4. 设置 > Dataview > 启用JavaScript查询(可选)
基础查询:
markdown
undefined

List all notes tagged with #project

列出所有标记为#project的笔记

dataview
LIST
FROM #project
dataview
LIST
FROM #project

Table of books with ratings

带评分的书籍表格

dataview
TABLE author, rating, status
FROM #book
SORT rating DESC
dataview
TABLE author, rating, status
FROM #book
SORT rating DESC

Tasks due this week

本周到期的任务

dataview
TASK
FROM "Projects"
WHERE due >= date(today) AND due <= date(today) + dur(7 days)
SORT due ASC
dataview
TASK
FROM "Projects"
WHERE due >= date(today) AND due <= date(today) + dur(7 days)
SORT due ASC

Recent notes (last 7 days)

最近7天创建的笔记

dataview
TABLE file.ctime as "Created", file.mtime as "Modified"
FROM ""
WHERE file.ctime >= date(today) - dur(7 days)
SORT file.ctime DESC
LIMIT 10

**Advanced Dataview Queries:**
```markdown
dataview
TABLE file.ctime as "Created", file.mtime as "Modified"
FROM ""
WHERE file.ctime >= date(today) - dur(7 days)
SORT file.ctime DESC
LIMIT 10

**高级Dataview查询:**
```markdown

Project Status Dashboard

项目状态仪表盘

dataview
TABLE WITHOUT ID
  file.link as "Project",
  status as "Status",
  priority as "Priority",
  due-date as "Due Date",
  (date(due-date) - date(today)).days as "Days Left"
FROM #project
WHERE status != "completed"
SORT priority ASC, due-date ASC
dataview
TABLE WITHOUT ID
  file.link as "Project",
  status as "Status",
  priority as "Priority",
  due-date as "Due Date",
  (date(due-date) - date(today)).days as "Days Left"
FROM #project
WHERE status != "completed"
SORT priority ASC, due-date ASC

Reading Progress

阅读进度

dataview
TABLE WITHOUT ID
  file.link as "Book",
  author as "Author",
  status as "Status",
  rating as "Rating"
FROM #book
WHERE status = "reading" OR status = "completed"
SORT status ASC, rating DESC
dataview
TABLE WITHOUT ID
  file.link as "Book",
  author as "Author",
  status as "Status",
  rating as "Rating"
FROM #book
WHERE status = "reading" OR status = "completed"
SORT status ASC, rating DESC

Notes by Area (grouped)

按领域分组的笔记

dataview
TABLE WITHOUT ID
  file.link as "Note",
  file.mtime as "Last Modified"
FROM "Areas"
GROUP BY file.folder
SORT file.mtime DESC
dataview
TABLE WITHOUT ID
  file.link as "Note",
  file.mtime as "Last Modified"
FROM "Areas"
GROUP BY file.folder
SORT file.mtime DESC

Meeting Action Items

会议行动项

dataview
TASK
FROM #meeting
WHERE !completed AND contains(text, "@")
GROUP BY file.link
SORT file.ctime DESC
dataview
TASK
FROM #meeting
WHERE !completed AND contains(text, "@")
GROUP BY file.link
SORT file.ctime DESC

Weekly Review - Notes Created

每周回顾 - 创建的笔记

dataview
TABLE WITHOUT ID
  file.link as "Note",
  file.ctime as "Created"
FROM ""
WHERE file.ctime >= date(today) - dur(7 days)
  AND !contains(file.path, "Templates")
SORT file.ctime DESC
dataview
TABLE WITHOUT ID
  file.link as "Note",
  file.ctime as "Created"
FROM ""
WHERE file.ctime >= date(today) - dur(7 days)
  AND !contains(file.path, "Templates")
SORT file.ctime DESC

Orphan Notes (no backlinks)

孤立笔记(无反向链接)

dataview
LIST
FROM ""
WHERE length(file.inlinks) = 0
  AND length(file.outlinks) = 0
  AND !contains(file.path, "Templates")
  AND !contains(file.path, "Archive")
LIMIT 20

**DataviewJS Examples:**
```javascript
// Custom table with calculated fields
```dataviewjs
const pages = dv.pages('#project')
  .where(p => p.status !== 'completed')
  .sort(p => p['due-date'], 'asc');

dv.table(
  ["Project", "Status", "Days Until Due", "Progress"],
  pages.map(p => [
    p.file.link,
    p.status,
    p['due-date'] ?
      Math.round((new Date(p['due-date']) - new Date()) / (1000 * 60 * 60 * 24)) :
      'No due date',
    `${p.progress || 0}%`
  ])
);
// Task summary by project
dataviewjs
const projects = dv.pages('#project');

for (let project of projects) {
  const tasks = project.file.tasks;
  const completed = tasks.filter(t => t.completed).length;
  const total = tasks.length;

  if (total > 0) {
    dv.paragraph(`**${project.file.name}**: ${completed}/${total} tasks (${Math.round(completed/total*100)}%)`);
  }
}
undefined
dataview
LIST
FROM ""
WHERE length(file.inlinks) = 0
  AND length(file.outlinks) = 0
  AND !contains(file.path, "Templates")
  AND !contains(file.path, "Archive")
LIMIT 20

**DataviewJS示例:**
```javascript
// 带计算字段的自定义表格
```dataviewjs
const pages = dv.pages('#project')
  .where(p => p.status !== 'completed')
  .sort(p => p['due-date'], 'asc');

dv.table(
  ["Project", "Status", "Days Until Due", "Progress"],
  pages.map(p => [
    p.file.link,
    p.status,
    p['due-date'] ?
      Math.round((new Date(p['due-date']) - new Date()) / (1000 * 60 * 60 * 24)) :
      'No due date',
    `${p.progress || 0}%`
  ])
);
// 按项目汇总任务
dataviewjs
const projects = dv.pages('#project');

for (let project of projects) {
  const tasks = project.file.tasks;
  const completed = tasks.filter(t => t.completed).length;
  const total = tasks.length;

  if (total > 0) {
    dv.paragraph(`**${project.file.name}**: ${completed}/${total} tasks (${Math.round(completed/total*100)}%)`);
  }
}
undefined

6. Templater Plugin

6. Templater插件

Installation:
markdown
1. Community plugins > Search "Templater"
2. Install and Enable
3. Settings > Templater > Template folder location: "Templates"
4. Enable "Trigger Templater on new file creation"
Templater Syntax:
markdown
undefined
安装步骤:
markdown
1. 社区插件 > 搜索"Templater"
2. 安装并启用
3. 设置 > Templater > 模板文件夹位置: "Templates"
4. 启用"Trigger Templater on new file creation"
Templater语法:
markdown
undefined

Basic Templater commands

基础Templater命令

Date/Time

日期/时间

<% tp.date.now("YYYY-MM-DD") %> <% tp.date.now("dddd, MMMM D, YYYY") %> <% tp.date.now("HH:mm") %> <% tp.date.yesterday("YYYY-MM-DD") %> <% tp.date.tomorrow("YYYY-MM-DD") %>
<% tp.date.now("YYYY-MM-DD") %> <% tp.date.now("dddd, MMMM D, YYYY") %> <% tp.date.now("HH:mm") %> <% tp.date.yesterday("YYYY-MM-DD") %> <% tp.date.tomorrow("YYYY-MM-DD") %>

File Information

文件信息

<% tp.file.title %> <% tp.file.path() %> <% tp.file.folder() %> <% tp.file.creation_date("YYYY-MM-DD") %>
<% tp.file.title %> <% tp.file.path() %> <% tp.file.folder() %> <% tp.file.creation_date("YYYY-MM-DD") %>

User Input

用户输入

<% tp.system.prompt("Enter project name") %> <% tp.system.suggester(["Option 1", "Option 2"], ["value1", "value2"]) %>
<% tp.system.prompt("Enter project name") %> <% tp.system.suggester(["Option 1", "Option 2"], ["value1", "value2"]) %>

Cursor Placement

光标位置

<% tp.file.cursor() %> <% tp.file.cursor(1) %> <!-- Named cursor -->
<% tp.file.cursor() %> <% tp.file.cursor(1) %> <!-- 命名光标 -->

File Operations

文件操作

<% tp.file.rename("New Name") %> <% tp.file.move("Folder/Subfolder") %>

**Advanced Templater Template:**
```markdown
<%*
// Prompt for project details
const projectName = await tp.system.prompt("Project Name");
const priority = await tp.system.suggester(
  ["High", "Medium", "Low"],
  ["high", "medium", "low"],
  false,
  "Select Priority"
);
const dueDate = await tp.system.prompt("Due Date (YYYY-MM-DD)",
  tp.date.now("YYYY-MM-DD", 30));

// Rename file
await tp.file.rename(projectName);

// Move to Projects folder
await tp.file.move(`Projects/${projectName}`);
-%>
---
title: <% projectName %>
type: project
status: planning
priority: <% priority %>
start-date: <% tp.date.now("YYYY-MM-DD") %>
due-date: <% dueDate %>
tags:
  - project
---
<% tp.file.rename("New Name") %> <% tp.file.move("Folder/Subfolder") %>

**高级Templater模板:**
```markdown
<%*
// 提示输入项目详情
const projectName = await tp.system.prompt("Project Name");
const priority = await tp.system.suggester(
  ["High", "Medium", "Low"],
  ["high", "medium", "low"],
  false,
  "Select Priority"
);
const dueDate = await tp.system.prompt("Due Date (YYYY-MM-DD)",
  tp.date.now("YYYY-MM-DD", 30));

// 重命名文件
await tp.file.rename(projectName);

// 移动到Projects文件夹
await tp.file.move(`Projects/${projectName}`);
-%>
---
title: <% projectName %>
type: project
status: planning
priority: <% priority %>
start-date: <% tp.date.now("YYYY-MM-DD") %>
due-date: <% dueDate %>
tags:
  - project
---

<% projectName %>

<% projectName %>

Overview

概述

<% tp.file.cursor() %>
<% tp.file.cursor() %>

Goals

目标

Milestones

里程碑

  • [ ]
  • [ ]

Resources

资源


Created: <% tp.date.now("YYYY-MM-DD HH:mm") %>

**Daily Note with Templater:**
```markdown
<%*
const yesterday = tp.date.now("YYYY-MM-DD", -1);
const tomorrow = tp.date.now("YYYY-MM-DD", 1);
const dayName = tp.date.now("dddd");
const weekNumber = tp.date.now("W");
-%>
---
date: <% tp.date.now("YYYY-MM-DD") %>
week: <% weekNumber %>
type: daily
---

创建时间: <% tp.date.now("YYYY-MM-DD HH:mm") %>

**基于Templater的每日笔记:**
```markdown
<%*
const yesterday = tp.date.now("YYYY-MM-DD", -1);
const tomorrow = tp.date.now("YYYY-MM-DD", 1);
const dayName = tp.date.now("dddd");
const weekNumber = tp.date.now("W");
-%>
---
date: <% tp.date.now("YYYY-MM-DD") %>
week: <% weekNumber %>
type: daily
---

<% tp.date.now("dddd, MMMM D, YYYY") %>

<% tp.date.now("dddd, MMMM D, YYYY") %>

Morning Routine

晨间例行事项

  • Review yesterday's notes
  • Check calendar
  • Set top 3 priorities
  • 回顾昨天的笔记
  • 查看日历
  • 设置Top 3优先级

Top 3 Priorities

Top 3优先级

  1. <% tp.file.cursor(1) %>
  1. <% tp.file.cursor(1) %>

Schedule

日程表

TimeActivity
09:00
10:00
11:00
12:00Lunch
13:00
14:00
15:00
16:00
17:00
时间事项
09:00
10:00
11:00
12:00午餐
13:00
14:00
15:00
16:00
17:00

Notes

笔记

Tasks Completed

已完成任务

Tomorrow's Preview

明日预览


[[<% yesterday %>]] | [[<% tomorrow %>]]
undefined

[[<% yesterday %>]] | [[<% tomorrow %>]]
undefined

7. Sync Strategies

7. 同步策略

Git-Based Sync:
bash
#!/bin/bash
基于Git的同步:
bash
#!/bin/bash

sync-vault.sh - Git-based vault sync

sync-vault.sh - 基于Git的库同步脚本

VAULT_PATH="$HOME/Documents/ObsidianVault" cd "$VAULT_PATH" || exit 1
VAULT_PATH="$HOME/Documents/ObsidianVault" cd "$VAULT_PATH" || exit 1

Initialize if not a git repo

如果不是Git仓库则初始化

if [ ! -d .git ]; then git init git remote add origin git@github.com:username/obsidian-vault.git fi
if [ ! -d .git ]; then git init git remote add origin git@github.com:username/obsidian-vault.git fi

Pull latest changes

拉取最新变更

echo "Pulling latest changes..." git pull --rebase origin main 2>/dev/null || true
echo "Pulling latest changes..." git pull --rebase origin main 2>/dev/null || true

Add all changes

添加所有变更

git add -A
git add -A

Commit if there are changes

如果有变更则提交

if ! git diff --cached --quiet; then COMMIT_MSG="Vault sync: $(date '+%Y-%m-%d %H:%M')" git commit -m "$COMMIT_MSG"
# Push changes
echo "Pushing changes..."
git push origin main
echo "Sync complete!"
else echo "No changes to sync." fi

**Automated Git Sync with Cron:**
```bash
if ! git diff --cached --quiet; then COMMIT_MSG="Vault sync: $(date '+%Y-%m-%d %H:%M')" git commit -m "$COMMIT_MSG"
# 推送变更
echo "Pushing changes..."
git push origin main
echo "Sync complete!"
else echo "No changes to sync." fi

**使用Cron实现Git自动同步:**
```bash

Add to crontab (crontab -e)

添加到crontab(执行crontab -e)

Sync every 30 minutes

每30分钟同步一次

*/30 * * * * /path/to/sync-vault.sh >> /var/log/obsidian-sync.log 2>&1
*/30 * * * * /path/to/sync-vault.sh >> /var/log/obsidian-sync.log 2>&1

Or use launchd on macOS

或者在macOS上使用launchd

~/Library/LaunchAgents/com.obsidian.sync.plist

~/Library/LaunchAgents/com.obsidian.sync.plist


```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.obsidian.sync</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/username/scripts/sync-vault.sh</string>
    </array>
    <key>StartInterval</key>
    <integer>1800</integer>
    <key>StandardOutPath</key>
    <string>/tmp/obsidian-sync.log</string>
    <key>StandardErrorPath</key>
    <string>/tmp/obsidian-sync-error.log</string>
</dict>
</plist>
Obsidian Sync (Official):
markdown
undefined

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.obsidian.sync</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/username/scripts/sync-vault.sh</string>
    </array>
    <key>StartInterval</key>
    <integer>1800</integer>
    <key>StandardOutPath</key>
    <string>/tmp/obsidian-sync.log</string>
    <key>StandardErrorPath</key>
    <string>/tmp/obsidian-sync-error.log</string>
</dict>
</plist>
Obsidian官方同步:
markdown
undefined

Obsidian Sync - Official Solution

Obsidian Sync - 官方解决方案

Pros: Seamless, end-to-end encrypted, version history

优点:无缝集成、端到端加密、版本历史

Cons: Paid subscription ($8/month or $96/year)

缺点:付费订阅(每月8美元或每年96美元)

Setup:
  1. Settings > Sync > Set up Obsidian Sync
  2. Log in with Obsidian account
  3. Create or connect to remote vault
  4. Select folders/files to sync
Best Practices:
  • Exclude large binary files
  • Use selective sync for large vaults
  • Enable "Sync all other types" for attachments

**iCloud Sync (macOS/iOS):**
```bash
设置步骤:
  1. 设置 > 同步 > 设置Obsidian Sync
  2. 使用Obsidian账户登录
  3. 创建或连接远程库
  4. 选择要同步的文件夹/文件
最佳实践:
  • 排除大型二进制文件
  • 大型库使用选择性同步
  • 启用"Sync all other types"以同步附件

**iCloud同步(macOS/iOS):**
```bash

Move vault to iCloud Drive

将库移动到iCloud Drive

VAULT_NAME="ObsidianVault" mv /Documents/$VAULT_NAME /Library/Mobile\ Documents/comappleCloudDocs/$VAULT_NAME
VAULT_NAME="ObsidianVault" mv /Documents/$VAULT_NAME /Library/Mobile\ Documents/comappleCloudDocs/$VAULT_NAME

Create symlink for easy access

创建符号链接以便快速访问

ln -s /Library/Mobile\ Documents/comapple~CloudDocs/$VAULT_NAME ~/Documents/$VAULT_NAME
ln -s /Library/Mobile\ Documents/comapple~CloudDocs/$VAULT_NAME ~/Documents/$VAULT_NAME

On iOS: Open Obsidian > Create new vault > Store in iCloud

在iOS上:打开Obsidian > 创建新库 > 存储在iCloud中


**Syncthing Setup:**
```bash

**Syncthing设置:**
```bash

Install Syncthing

安装Syncthing

brew install syncthing # macOS sudo apt install syncthing # Ubuntu
brew install syncthing # macOS sudo apt install syncthing # Ubuntu

Start Syncthing

启动Syncthing

syncthing
syncthing

Access web GUI at http://localhost:8384

访问Web GUI:http://localhost:8384

Add folder: ~/Documents/ObsidianVault

添加文件夹: ~/Documents/ObsidianVault

Share with other devices

与其他设备共享

Syncthing ignore patterns (.stignore)

Syncthing忽略规则(.stignore)

.obsidian/workspace.json .obsidian/workspace-mobile.json .trash .sync-conflict-
undefined
.obsidian/workspace.json .obsidian/workspace-mobile.json .trash .sync-conflict-
undefined

8. Backup Strategies

8. 备份策略

Automated Backup Script:
bash
#!/bin/bash
自动备份脚本:
bash
#!/bin/bash

backup-vault.sh - Comprehensive vault backup

backup-vault.sh - 全面的库备份脚本

VAULT_PATH="$HOME/Documents/ObsidianVault" BACKUP_DIR="$HOME/Backups/Obsidian" DATE=$(date +%Y-%m-%d_%H%M%S) BACKUP_NAME="obsidian-backup-$DATE"
VAULT_PATH="$HOME/Documents/ObsidianVault" BACKUP_DIR="$HOME/Backups/Obsidian" DATE=$(date +%Y-%m-%d_%H%M%S) BACKUP_NAME="obsidian-backup-$DATE"

Create backup directory

创建备份目录

mkdir -p "$BACKUP_DIR"
mkdir -p "$BACKUP_DIR"

Create compressed backup

创建压缩备份

echo "Creating backup: $BACKUP_NAME.tar.gz" tar -czf "$BACKUP_DIR/$BACKUP_NAME.tar.gz"
-C "$(dirname "$VAULT_PATH")"
"$(basename "$VAULT_PATH")"
echo "Creating backup: $BACKUP_NAME.tar.gz" tar -czf "$BACKUP_DIR/$BACKUP_NAME.tar.gz"
-C "$(dirname "$VAULT_PATH")"
"$(basename "$VAULT_PATH")"

Keep only last 30 backups

仅保留最近30个备份

cd "$BACKUP_DIR" ls -t obsidian-backup-*.tar.gz | tail -n +31 | xargs -r rm
cd "$BACKUP_DIR" ls -t obsidian-backup-*.tar.gz | tail -n +31 | xargs -r rm

Calculate backup size

计算备份大小

SIZE=$(du -h "$BACKUP_DIR/$BACKUP_NAME.tar.gz" | cut -f1) echo "Backup complete: $SIZE"
SIZE=$(du -h "$BACKUP_DIR/$BACKUP_NAME.tar.gz" | cut -f1) echo "Backup complete: $SIZE"

Optional: Upload to cloud storage

可选:上传到云存储

rclone copy "$BACKUP_DIR/$BACKUP_NAME.tar.gz" remote:backups/obsidian/

rclone copy "$BACKUP_DIR/$BACKUP_NAME.tar.gz" remote:backups/obsidian/

Optional: Verify backup integrity

可选:验证备份完整性

tar -tzf "$BACKUP_DIR/$BACKUP_NAME.tar.gz" > /dev/null 2>&1 &&
echo "Backup verified successfully" ||
echo "WARNING: Backup verification failed!"

**Cloud Backup with rclone:**
```bash
#!/bin/bash
tar -tzf "$BACKUP_DIR/$BACKUP_NAME.tar.gz" > /dev/null 2>&1 &&
echo "Backup verified successfully" ||
echo "WARNING: Backup verification failed!"

**使用rclone实现云备份:**
```bash
#!/bin/bash

cloud-backup.sh - Backup to multiple cloud providers

cloud-backup.sh - 备份到多个云服务商

VAULT_PATH="$HOME/Documents/ObsidianVault" DATE=$(date +%Y-%m-%d)
VAULT_PATH="$HOME/Documents/ObsidianVault" DATE=$(date +%Y-%m-%d)

Sync to Google Drive

同步到Google Drive

rclone sync "$VAULT_PATH" gdrive:Backups/Obsidian
--exclude ".obsidian/workspace*.json"
--exclude ".trash/**"
rclone sync "$VAULT_PATH" gdrive:Backups/Obsidian
--exclude ".obsidian/workspace*.json"
--exclude ".trash/**"

Sync to Dropbox

同步到Dropbox

rclone sync "$VAULT_PATH" dropbox:Backups/Obsidian
--exclude ".obsidian/workspace*.json"
--exclude ".trash/**"
rclone sync "$VAULT_PATH" dropbox:Backups/Obsidian
--exclude ".obsidian/workspace*.json"
--exclude ".trash/**"

Create versioned snapshot on S3

在S3上创建版本化快照

rclone copy "$VAULT_PATH" s3:bucket-name/obsidian/$DATE
--exclude ".obsidian/workspace*.json"
--exclude ".trash/**"
echo "Cloud backup complete: $DATE"

**Backup Verification:**
```bash
#!/bin/bash
rclone copy "$VAULT_PATH" s3:bucket-name/obsidian/$DATE
--exclude ".obsidian/workspace*.json"
--exclude ".trash/**"
echo "Cloud backup complete: $DATE"

**备份验证:**
```bash
#!/bin/bash

verify-backup.sh - Test backup restoration

verify-backup.sh - 测试备份恢复

BACKUP_FILE="$1" TEST_DIR="/tmp/obsidian-backup-test"
if [ -z "$BACKUP_FILE" ]; then echo "Usage: verify-backup.sh <backup-file.tar.gz>" exit 1 fi
BACKUP_FILE="$1" TEST_DIR="/tmp/obsidian-backup-test"
if [ -z "$BACKUP_FILE" ]; then echo "Usage: verify-backup.sh <backup-file.tar.gz>" exit 1 fi

Clean test directory

清理测试目录

rm -rf "$TEST_DIR" mkdir -p "$TEST_DIR"
rm -rf "$TEST_DIR" mkdir -p "$TEST_DIR"

Extract backup

提取备份

echo "Extracting backup..." tar -xzf "$BACKUP_FILE" -C "$TEST_DIR"
echo "Extracting backup..." tar -xzf "$BACKUP_FILE" -C "$TEST_DIR"

Verify contents

验证内容

echo "Verifying contents..." ORIGINAL_COUNT=$(find "$HOME/Documents/ObsidianVault" -type f -name ".md" | wc -l) BACKUP_COUNT=$(find "$TEST_DIR" -type f -name ".md" | wc -l)
echo "Original notes: $ORIGINAL_COUNT" echo "Backup notes: $BACKUP_COUNT"
if [ "$ORIGINAL_COUNT" -eq "$BACKUP_COUNT" ]; then echo "Verification PASSED" else echo "WARNING: Note count mismatch!" fi
echo "Verifying contents..." ORIGINAL_COUNT=$(find "$HOME/Documents/ObsidianVault" -type f -name ".md" | wc -l) BACKUP_COUNT=$(find "$TEST_DIR" -type f -name ".md" | wc -l)
echo "Original notes: $ORIGINAL_COUNT" echo "Backup notes: $BACKUP_COUNT"
if [ "$ORIGINAL_COUNT" -eq "$BACKUP_COUNT" ]; then echo "Verification PASSED" else echo "WARNING: Note count mismatch!" fi

Cleanup

清理

rm -rf "$TEST_DIR"
undefined
rm -rf "$TEST_DIR"
undefined

Integration Examples

集成示例

Integration with Git Repositories

与Git仓库集成

bash
#!/bin/bash
bash
#!/bin/bash

Link project documentation to code repository

将项目文档链接到代码仓库

PROJECT_NAME="my-project" CODE_REPO="$HOME/code/$PROJECT_NAME" VAULT_PATH="$HOME/Documents/ObsidianVault"
PROJECT_NAME="my-project" CODE_REPO="$HOME/code/$PROJECT_NAME" VAULT_PATH="$HOME/Documents/ObsidianVault"

Create project folder in vault

在库中创建项目文件夹

mkdir -p "$VAULT_PATH/Projects/$PROJECT_NAME"
mkdir -p "$VAULT_PATH/Projects/$PROJECT_NAME"

Symlink docs folder from code repo

从代码仓库符号链接docs文件夹

ln -s "$CODE_REPO/docs" "$VAULT_PATH/Projects/$PROJECT_NAME/Docs"
ln -s "$CODE_REPO/docs" "$VAULT_PATH/Projects/$PROJECT_NAME/Docs"

Create project overview note

创建项目概述笔记

cat > "$VAULT_PATH/Projects/$PROJECT_NAME/Overview.md" << EOF

title: $PROJECT_NAME type: project repo: $CODE_REPO status: active

cat > "$VAULT_PATH/Projects/$PROJECT_NAME/Overview.md" << EOF

title: $PROJECT_NAME type: project repo: $CODE_REPO status: active

$PROJECT_NAME

$PROJECT_NAME

Repository

仓库

`$CODE_REPO`
`$CODE_REPO`

Documentation

文档

  • [[Docs/README|README]]
  • [[Docs/API|API Reference]]
  • [[Docs/README|README]]
  • [[Docs/API|API Reference]]

Notes

笔记

Tasks

任务

  • EOF
undefined
  • EOF
undefined

Integration with Todoist

与Todoist集成

python
#!/usr/bin/env python3
"""sync_todoist_obsidian.py - Sync Todoist tasks to Obsidian"""

import os
import json
from datetime import datetime
from todoist_api_python import TodoistAPI

TODOIST_API_KEY = os.environ.get("TODOIST_API_KEY")
VAULT_PATH = os.path.expanduser("~/Documents/ObsidianVault")

def sync_todoist_to_obsidian():
    api = TodoistAPI(TODOIST_API_KEY)

    # Get all tasks due today
    tasks = api.get_tasks(filter="today | overdue")

    # Generate markdown
    today = datetime.now().strftime("%Y-%m-%d")
    content = f"""---
date: {today}
source: todoist
type: task-sync
---
python
#!/usr/bin/env python3
"""sync_todoist_obsidian.py - 将Todoist任务同步到Obsidian"""

import os
import json
from datetime import datetime
from todoist_api_python import TodoistAPI

TODOIST_API_KEY = os.environ.get("TODOIST_API_KEY")
VAULT_PATH = os.path.expanduser("~/Documents/ObsidianVault")

def sync_todoist_to_obsidian():
    api = TodoistAPI(TODOIST_API_KEY)

    # 获取今日或逾期的所有任务
    tasks = api.get_tasks(filter="today | overdue")

    # 生成Markdown内容
    today = datetime.now().strftime("%Y-%m-%d")
    content = f"""---
date: {today}
source: todoist
type: task-sync
---

Todoist Tasks - {today}

Todoist任务 - {today}

Due Today

今日到期

"""
for task in tasks:
    checkbox = "[ ]" if not task.is_completed else "[x]"
    due_str = task.due.string if task.due else "No due date"
    content += f"- {checkbox} {task.content} (Due: {due_str})\n"

# Write to vault
output_path = f"{VAULT_PATH}/Inbox/Todoist-{today}.md"
with open(output_path, "w") as f:
    f.write(content)

print(f"Synced {len(tasks)} tasks to {output_path}")
if name == "main": sync_todoist_to_obsidian()
undefined
"""
for task in tasks:
    checkbox = "[ ]" if not task.is_completed else "[x]"
    due_str = task.due.string if task.due else "无到期日期"
    content += f"- {checkbox} {task.content} (到期: {due_str})\n"

# 写入到库中
output_path = f"{VAULT_PATH}/Inbox/Todoist-{today}.md"
with open(output_path, "w") as f:
    f.write(content)

print(f"已同步{len(tasks)}个任务到{output_path}")
if name == "main": sync_todoist_to_obsidian()
undefined

Integration with Notion Export

与Notion导出集成

python
#!/usr/bin/env python3
"""notion_to_obsidian.py - Export Notion pages to Obsidian"""

import os
import re
from notion_client import Client

NOTION_API_KEY = os.environ.get("NOTION_API_KEY")
VAULT_PATH = os.path.expanduser("~/Documents/ObsidianVault")

def notion_to_markdown(block):
    """Convert Notion block to markdown"""
    block_type = block["type"]

    if block_type == "paragraph":
        text = extract_text(block["paragraph"]["rich_text"])
        return f"{text}\n\n"
    elif block_type == "heading_1":
        text = extract_text(block["heading_1"]["rich_text"])
        return f"# {text}\n\n"
    elif block_type == "heading_2":
        text = extract_text(block["heading_2"]["rich_text"])
        return f"## {text}\n\n"
    elif block_type == "heading_3":
        text = extract_text(block["heading_3"]["rich_text"])
        return f"### {text}\n\n"
    elif block_type == "bulleted_list_item":
        text = extract_text(block["bulleted_list_item"]["rich_text"])
        return f"- {text}\n"
    elif block_type == "numbered_list_item":
        text = extract_text(block["numbered_list_item"]["rich_text"])
        return f"1. {text}\n"
    elif block_type == "to_do":
        text = extract_text(block["to_do"]["rich_text"])
        checked = "x" if block["to_do"]["checked"] else " "
        return f"- [{checked}] {text}\n"
    elif block_type == "code":
        text = extract_text(block["code"]["rich_text"])
        language = block["code"]["language"]
        return f"```{language}\n{text}\n```\n\n"

    return ""

def extract_text(rich_text):
    """Extract plain text from Notion rich text"""
    return "".join([t["plain_text"] for t in rich_text])

def export_page(notion, page_id, output_path):
    """Export a Notion page to markdown file"""
    # Get page properties
    page = notion.pages.retrieve(page_id)
    title = extract_text(page["properties"]["title"]["title"])

    # Get page content
    blocks = notion.blocks.children.list(page_id)

    content = f"""---
title: {title}
source: notion
imported: {datetime.now().strftime("%Y-%m-%d")}
---
python
#!/usr/bin/env python3
"""notion_to_obsidian.py - 将Notion页面导出到Obsidian"""

import os
import re
from notion_client import Client
from datetime import datetime

NOTION_API_KEY = os.environ.get("NOTION_API_KEY")
VAULT_PATH = os.path.expanduser("~/Documents/ObsidianVault")

def notion_to_markdown(block):
    """将Notion块转换为Markdown"""
    block_type = block["type"]

    if block_type == "paragraph":
        text = extract_text(block["paragraph"]["rich_text"])
        return f"{text}\n\n"
    elif block_type == "heading_1":
        text = extract_text(block["heading_1"]["rich_text"])
        return f"# {text}\n\n"
    elif block_type == "heading_2":
        text = extract_text(block["heading_2"]["rich_text"])
        return f"## {text}\n\n"
    elif block_type == "heading_3":
        text = extract_text(block["heading_3"]["rich_text"])
        return f"### {text}\n\n"
    elif block_type == "bulleted_list_item":
        text = extract_text(block["bulleted_list_item"]["rich_text"])
        return f"- {text}\n"
    elif block_type == "numbered_list_item":
        text = extract_text(block["numbered_list_item"]["rich_text"])
        return f"1. {text}\n"
    elif block_type == "to_do":
        text = extract_text(block["to_do"]["rich_text"])
        checked = "x" if block["to_do"]["checked"] else " "
        return f"- [{checked}] {text}\n"
    elif block_type == "code":
        text = extract_text(block["code"]["rich_text"])
        language = block["code"]["language"]
        return f"```{language}\n{text}\n```\n\n"

    return ""

def extract_text(rich_text):
    """从Notion富文本中提取纯文本"""
    return "".join([t["plain_text"] for t in rich_text])

def export_page(notion, page_id, output_path):
    """将Notion页面导出为Markdown文件"""
    # 获取页面属性
    page = notion.pages.retrieve(page_id)
    title = extract_text(page["properties"]["title"]["title"])

    # 获取页面内容
    blocks = notion.blocks.children.list(page_id)

    content = f"""---
title: {title}
source: notion
imported: {datetime.now().strftime("%Y-%m-%d")}
---

{title}

{title}

"""
for block in blocks["results"]:
    content += notion_to_markdown(block)

# Write to vault
safe_title = re.sub(r'[<>:"/\\|?*]', '', title)
filepath = f"{output_path}/{safe_title}.md"

with open(filepath, "w") as f:
    f.write(content)

print(f"Exported: {title}")
"""
for block in blocks["results"]:
    content += notion_to_markdown(block)

# 写入到库中
safe_title = re.sub(r'[<>:"/\\|?*]', '', title)
filepath = f"{output_path}/{safe_title}.md"

with open(filepath, "w") as f:
    f.write(content)

print(f"已导出: {title}")

Usage

使用示例

notion = Client(auth=NOTION_API_KEY) export_page(notion, "page-id-here", f"{VAULT_PATH}/Imports/Notion")
undefined
notion = Client(auth=NOTION_API_KEY) export_page(notion, "page-id-here", f"{VAULT_PATH}/Imports/Notion")
undefined

Best Practices

最佳实践

1. Note Naming and Organization

1. 笔记命名与组织

markdown
undefined
markdown
undefined

Use consistent naming conventions

使用一致的命名规范

  • lowercase-with-hyphens.md (recommended)
  • Title Case Note Name.md (acceptable)
  • Avoid: spaces_underscores_MixedCase.md
  • lowercase-with-hyphens.md(推荐)
  • Title Case Note Name.md(可接受)
  • 避免: spaces_underscores_MixedCase.md

Date prefix for temporal notes

时间相关笔记使用日期前缀

2025-01-17 Daily Note.md 2025-01-17 Meeting with Team.md
2025-01-17 Daily Note.md 2025-01-17 Meeting with Team.md

Unique identifier prefix for Zettelkasten

Zettelkasten笔记使用唯一标识符前缀

202501171430 Concept Name.md
202501171430 Concept Name.md

Project prefix for project notes

项目笔记使用项目前缀

Project-Alpha Meeting Notes.md Project-Alpha Requirements.md
undefined
Project-Alpha Meeting Notes.md Project-Alpha Requirements.md
undefined

2. Linking Strategy

2. 链接策略

markdown
undefined
markdown
undefined

Link generously but meaningfully

慷慨但有意义地链接

  • Link when concepts are related
  • Don't link common words
  • Use descriptive link text
  • 当概念相关时进行链接
  • 不要链接常见词汇
  • 使用描述性的链接文本

Create hub notes (MOCs - Maps of Content)

创建中心笔记(MOC - 内容地图)

These serve as entry points to topics

这些是主题的入口点

Example MOC: Programming MOC.md

示例MOC: Programming MOC.md

[[Python Basics]]

[[Python Basics]]

[[JavaScript Fundamentals]]

[[JavaScript Fundamentals]]

[[Data Structures]]

[[Data Structures]]

Use unlinked mentions to discover connections

使用未链接提及发现关联

Settings > Core plugins > Backlinks > Show unlinked mentions

设置 > 核心插件 > 反向链接 > 显示未链接提及

undefined
undefined

3. Daily Notes Workflow

3. 每日笔记工作流

markdown
undefined
markdown
undefined

Morning routine

晨间流程

  1. Create daily note from template
  2. Review yesterday's note
  3. Set top 3 priorities
  4. Check calendar and add scheduled items
  1. 从模板创建每日笔记
  2. 回顾昨天的笔记
  3. 设置Top 3优先级
  4. 查看日历并添加预定事项

Throughout the day

日间流程

  • Capture thoughts in daily note
  • Link to relevant notes
  • Create new notes for substantial ideas
  • 在每日笔记中捕获想法
  • 链接到相关笔记
  • 为重要想法创建新笔记

Evening routine

晚间流程

  • Review completed tasks
  • Process inbox items
  • Reflect on the day
  • Preview tomorrow
undefined
  • 回顾已完成任务
  • 处理收件箱中的内容
  • 反思当天的情况
  • 预览明天的计划
undefined

4. Progressive Summarization

4. 渐进式总结

markdown
undefined
markdown
undefined

Layer 0: Original content (source)

第0层: 原始内容(来源)

Layer 1: Bold key passages

第1层: 加粗关键段落

Layer 2: Highlight within bold

第2层: 在加粗内容中高亮

Layer 3: Executive summary at top

第3层: 在顶部添加执行摘要

Example:

示例:

Summary

摘要

Key insight in 2-3 sentences.
用2-3句话概括核心观点。

Notes

笔记

The original passage contains important information that stands out. Within that, ==the most crucial point== is highlighted.
undefined
原始段落包含突出的重要信息。 其中,==最关键的点==被高亮显示。
undefined

5. Maintenance Routines

5. 维护流程

markdown
undefined
markdown
undefined

Weekly Review

每周回顾

  • Process inbox notes
  • Review orphan notes
  • Update project statuses
  • Clean up dead links
  • 处理收件箱笔记
  • 回顾孤立笔记
  • 更新项目状态
  • 清理失效链接

Monthly Review

每月回顾

  • Archive completed projects
  • Review and update MOCs
  • Backup vault
  • Update plugins
  • 归档已完成项目
  • 回顾并更新MOC
  • 备份库
  • 更新插件

Use Dataview for maintenance

使用Dataview进行维护

dataview
LIST
FROM ""
WHERE file.mtime < date(today) - dur(90 days)
  AND !contains(file.path, "Archive")
  AND !contains(file.path, "Templates")
LIMIT 20
undefined
dataview
LIST
FROM ""
WHERE file.mtime < date(today) - dur(90 days)
  AND !contains(file.path, "Archive")
  AND !contains(file.path, "Templates")
LIMIT 20
undefined

Troubleshooting

故障排除

Common Issues

常见问题

Issue: Slow performance with large vault
markdown
Solutions:
1. Disable unused plugins
2. Reduce graph view nodes: Settings > Graph > Filters
3. Exclude folders from search: Settings > Files & Links > Excluded files
4. Use lazy loading for Dataview
5. Split into multiple vaults if > 10,000 notes
Issue: Sync conflicts
markdown
Solutions:
1. Close Obsidian on all devices before syncing
2. Use .sync-conflict-* in .gitignore
3. For Git sync: pull before editing
4. For iCloud: wait for sync indicator
5. Use Obsidian Sync for best experience
Issue: Broken links after moving notes
markdown
Solutions:
1. Use Obsidian's built-in move (F2 or right-click > Move)
2. Enable "Automatically update internal links"
3. Use Consistent Attachments and Links plugin
4. Run "Find and replace in all files" for bulk fixes
Issue: Images not displaying
markdown
Solutions:
1. Check attachment folder setting
2. Use relative paths: ![[image.png]]
3. Verify file exists in vault
4. Check file extension (case-sensitive on Linux)
5. For external images: ensure URL is accessible
Issue: Plugin conflicts
markdown
Solutions:
1. Disable all plugins, enable one by one
2. Check plugin compatibility in settings
3. Clear plugin cache: .obsidian/plugins/*/
4. Update all plugins to latest versions
5. Check plugin GitHub for known issues
问题: 大型库运行缓慢
markdown
解决方案:
1. 禁用未使用的插件
2. 减少图谱视图节点: 设置 > 图谱 > 过滤器
3. 排除文件夹不参与搜索: 设置 > 文件与链接 > 排除文件
4. 为Dataview启用懒加载
5. 如果笔记超过10000条,拆分为多个库
问题: 同步冲突
markdown
解决方案:
1. 同步前关闭所有设备上的Obsidian
2. 在.gitignore中添加.sync-conflict-*
3. Git同步: 编辑前先拉取
4. iCloud同步: 等待同步指示器完成
5. 最佳体验使用Obsidian Sync
问题: 移动笔记后链接失效
markdown
解决方案:
1. 使用Obsidian内置的移动功能(F2或右键>移动)
2. 启用"自动更新内部链接"
3. 使用Consistent Attachments and Links插件
4. 使用"在所有文件中查找和替换"进行批量修复
问题: 图片无法显示
markdown
解决方案:
1. 检查附件文件夹设置
2. 使用相对路径: ![[image.png]]
3. 验证文件是否存在于库中
4. 检查文件扩展名(Linux区分大小写)
5. 外部图片: 确保URL可访问
问题: 插件冲突
markdown
解决方案:
1. 禁用所有插件,逐个启用排查
2. 在设置中检查插件兼容性
3. 清理插件缓存: .obsidian/plugins/*/
4. 将所有插件更新到最新版本
5. 查看插件GitHub仓库的已知问题

Plugin Recommendations

插件推荐

markdown
undefined
markdown
undefined

Essential Plugins

必备插件

  • Dataview - Query and display data
  • Templater - Advanced templating
  • Calendar - Visual date navigation
  • Periodic Notes - Daily/weekly/monthly notes
  • Quick Switcher++ - Enhanced note switching
  • Dataview - 查询和展示数据
  • Templater - 高级模板
  • Calendar - 可视化日期导航
  • Periodic Notes - 每日/每周/每月笔记
  • Quick Switcher++ - 增强版笔记切换

Productivity

生产力类

  • Tasks - Task management
  • Kanban - Visual task boards
  • Day Planner - Schedule visualization
  • Reminder - Task reminders
  • Tasks - 任务管理
  • Kanban - 可视化任务看板
  • Day Planner - 日程可视化
  • Reminder - 任务提醒

Writing

写作类

  • Linter - Markdown formatting
  • Natural Language Dates - "tomorrow", "next week"
  • Paste URL into selection - Smart link pasting
  • Auto Link Title - Fetch titles for URLs
  • Linter - Markdown格式化
  • Natural Language Dates - 支持"tomorrow"、"next week"
  • Paste URL into selection - 智能链接粘贴
  • Auto Link Title - 自动获取URL标题

Organization

组织类

  • Tag Wrangler - Manage tags
  • Folder Note - Folder as note
  • Recent Files - Quick access to recent notes
  • Starred - Bookmark important notes
undefined
  • Tag Wrangler - 标签管理
  • Folder Note - 将文件夹作为笔记
  • Recent Files - 快速访问最近笔记
  • Starred - 书签重要笔记
undefined

Version History

版本历史

VersionDateChanges
1.0.02025-01-17Initial release with comprehensive Obsidian patterns
版本日期变更
1.0.02025-01-17初始发布,包含完整的Obsidian使用模式

Resources

资源


This skill enables building a powerful, privacy-first knowledge management system with Obsidian's markdown-based approach, bidirectional linking, and extensible plugin ecosystem.

本技能帮助你利用Obsidian的Markdown优先方法、双向链接和可扩展插件生态系统,构建强大的、注重隐私的知识管理系统。