Phase 0-2: Schema cleanup, typed relations, event-driven automation

- Phase 0: AGENTS.md cleanup (dedup quotes, renumber sections, merge qmd)
- Phase 1: typed relations (manage-relations.py, graph-search.py, check-staleness.py, detect-conflicts.py)
- Phase 2: frontmatter validator, weekly lint, knowledge promotion, git hooks
- Fix .gitignore to track tools/ and .githooks/
- Fix git remote URL (remove plaintext token)
- New wiki pages: 504 pages, 34 raw sources
This commit is contained in:
hehaiguang1123
2026-07-01 08:05:43 +08:00
parent e544d6e04a
commit a6f05ab2d5
1067 changed files with 522992 additions and 819 deletions
@@ -0,0 +1,542 @@
---
title: 生成地点笔记文件完整流程总结
created: 2026-04-13
tags:
- tools/obsidian
- tools/bases
- tools/map
- type/指南
- places/笔记规范
description: Obsidian中生成地点笔记文件的完整流程、规范和最佳实践
para:
- places
- resources
categories:
- "[[LLM Wiki]]"
- "[[Places]]"
source: "[[地点笔记文件生成流程总结]]"
type: place
loc: []
rating:
last: 2026-04-13
---
# 生成地点笔记文件完整流程总结
## 一、前期准备
### 1.1 参考现有模板
**必读参考文件:**
```
References/Kyoto.md # 地点笔记结构示例
Templates/Place Template.md # 基础frontmatter模板
Templates/Bases/Places.base # Places的Base视图配置
Templates/Bases/Map.base # 地图视图配置参考
```
**参考Kyoto.md的关键模式:**
```yaml
# Frontmatter格式
categories:
- "[[LLM Wiki]]"
- "[[Places]]" # 字符串格式,不是Wikilink
type: place
- landmark # 列表格式,每项一行
loc:
- "[[Wuhan]]" # Wikilink格式
coordinates:
- "30.5438" # 分两行的字符串格式
- "114.3055"
rating: 5
```
**参考Kyoto.md的内容结构:**
```markdown
## Trips
![[Templates/Bases/Trips.base#Location]]
## Places
![[Templates/Bases/Map.base#Location]]
![[Templates/Bases/Places.base#Location]]
```
### 1.2 检查必要条件
| 检查项 | 要求 | 状态 |
|--------|------|------|
| Places分类存在 | `Categories/Places.md` | ✅ |
| Map.base模板 | `Templates/Bases/Map.base` | ✅ |
| Places.base模板 | `Templates/Bases/Places.base` | ✅ |
| Trips.base模板 | `Templates/Bases/Trips.base` | ✅ |
| 瓦片代理启动 | 端口18090运行 | ⚠️ 地图加载前提 |
---
## 二、文件创建流程
### 2.1 创建地点笔记
**文件路径:** `References/[地点名称].md`
**Frontmatter配置:**
```yaml
---
categories:
- "[[LLM Wiki]]"
- "[[Places]]" # 字符串格式Wikilink
type: place
- landmark # 类型1
- tower # 类型2(可选)
loc:
- "[[Wuhan]]" # 地区Wikilink
coordinates:
- "30.5438" # 纬度(字符串)
- "114.3055" # 经度(字符串)
rating: 5
address: 湖北省武汉市武昌区蛇山西端
icon: 🏯
color: #d4a574
created: 2026-04-10
---
```
**Frontmatter字段说明:**
| 字段 | 格式 | 用途 | 示例 |
|------|------|------|------|
| **categories** | 字符串列表 | 主分类 | `"[[Places]]"` |
| **type** | 列表 | 地点类型 | `landmark`, `tower` |
| **loc** | Wikilink列表 | 地理位置 | `"[[Wuhan]]"` |
| **coordinates** | 分两行字符串 | 地图坐标 | `"30.5438"` |
| **rating** | 数字 | 评分 | `5` |
| **address** | 字符串 | 详细地址 | 汉字地址 |
| **icon** | Emoji | 标记图标 | `🏯` |
| **color** | 十六进制 | 标记颜色 | `#d4a574` |
| **created** | YYYY-MM-DD | 创建日期 | `2026-04-10` |
### 2.2 内容结构
```markdown
# [地点名称]
简介描述...
## 历史背景
## 建筑特色
## 文化价值
## 地理位置与交通
## 游览建议
## Trips
![[Templates/Bases/Trips.base#Location]]
## Places
![[Templates/Bases/Map.base#Location]]
![[Templates/Bases/Places.base#Location]]
## 参考资料
```
---
## 三、Base视图配置
### 3.1 Places.base Location地图视图
**文件:** `Templates/Bases/Places.base`
**添加Location地图视图:**
```yaml
- type: map
name: Location
filters:
and:
- list(loc).contains(this)
order:
- file.name
- type
- rating
- last
sort:
- property: rating
direction: DESC
- property: last
direction: DESC
- property: loc
direction: ASC
coordinates: note.coordinates # ⚠️ 关键配置
markerIcon: note.icon
markerColor: note.color
defaultZoom: 12
```
**关键配置点:**
-`coordinates: note.coordinates` - 读取笔记的coordinates属性
-`markerIcon: note.icon` - 使用笔记的icon属性作为标记图标
-`markerColor: note.color` - 使用笔记的color属性作为标记颜色
-`defaultZoom: 12` - 默认缩放级别
-`filters: list(loc).contains(this)` - 只显示loc包含当前地点的笔记
### 3.2 为什么需要修改Places.base
**问题:** 原Places.base只有表格视图,没有地图视图
**解决:** 添加Location地图视图,使`![[Templates/Bases/Places.base#Location]]`能显示为地图
**影响范围:**
- ✅ 不影响现有的Places、Type、Related等表格视图
- ✅ 只新增一个Location地图视图
- ✅ 所有使用Places.base的地点笔记都会受益
---
## 四、常见问题与解决方案
### 4.1 Categories显示错误
**问题:** categories显示为 `[[Places]]``\[[Places]]\`
**原因:** 格式混淆
| 格式 | 正确性 | 说明 |
|------|--------|------|
| `[[Places]]` | ⚠️ Wikilink格式 | 适用于内联链接 |
| `"[[Places]]"` | ✅ 字符串格式 | Places.base期望的格式 |
| `\[[Places]]\` | ❌ 错误 | 反斜杠转义 |
**解决:**
```yaml
categories:
- "[[LLM Wiki]]"
- "[[Places]]" # 正确
```
### 4.2 Coordinates格式不兼容
**问题:** 地图无法显示标记点
**常见格式:**
| 格式 | 兼容性 | 说明 |
|------|--------|------|
| `location: [30.5438, 114.3055]` | ❌ | 数组格式,Maps插件不支持 |
| `coordinates: [30.5438, 114.3055]` | ⚠️ | 数组格式,需Places.base配置 |
| `coordinates: "30.5438, 114.3055"` | ⚠️ | 单行字符串,需拆分 |
| `coordinates:\n - "30.5438"\n - "114.3055"` | ✅ | 分两行的字符串格式 |
**解决(Kyoto模式):**
```yaml
coordinates:
- "30.5438"
- "114.3055"
```
### 4.3 Base文件解析错误
**问题:** Obsidian报错"无法解析数据库文件"
**常见原因:**
1. **YAML缩进错误**
```yaml
# ❌ 错误
views:
- type: map
name: 地图 # 缩进不一致
# ✅ 正确
views:
- type: map
name: 地图 # 统一缩进
```
2. **特殊字符未转义**
```yaml
# ❌ 错误
description: "This is a "quote" test"
# ✅ 正确
description: 'This is a "quote" test'
```
3. **坐标配置缺失**
```yaml
# ❌ 缺少coordinates配置
- type: map
name: Location
# ✅ 添加coordinates
- type: map
name: Location
coordinates: note.coordinates
```
**解决方法:**
1. 参考Obsidian Bases文档
2. 使用在线YAML验证器
4. 从简单配置开始,逐步添加功能
### 4.4 地址编码乱码
**问题:** address字段显示为乱码
**原因:** 文件保存时使用了错误的编码
**解决:**
```powershell
# 使用UTF-8编码重写文件
$content = Get-Content "文件路径" -Encoding UTF8
Set-Content -Path "文件路径" -Value $content -Encoding UTF8 -NoNewline
```
### 4.5 地图空白无法加载
**问题:** Base地图视图显示空白
**检查清单:**
| 检查项 | 操作 | 预期结果 |
|--------|------|---------|
| 瓦片代理运行 | 浏览器访问 <http://127.0.0.1:18090/status> | "ok" |
| Maps插件启用 | 设置 → 社区插件 → Maps | ✅ 开启 |
| 地图背景配置 | Maps设置 → Background | 有5+选项 |
| coordinates属性存在 | 检查笔记frontmatter | 有coordinates字段 |
| 坐标格式正确 | `coordinates:\n - "lat"\n - "lng"` | 分两行字符串 |
---
## 五、最佳实践建议
### 5.1 文件组织
```
MyNotes/
├── 黄鹤楼.md # 地点笔记
├── 故宫.md
└── 长城.md
Categories/
└── Places.md # Places分类索引
Templates/Bases/
├── Places.base # Places的Base配置(含Location地图视图)
├── Map.base # 全局地图视图
└── Trips.base # 旅行记录
```
### 5.2 Frontmatter规范
**推荐顺序:**
1. categories(主分类)
2. type(类型)
3. loc(地区)
4. coordinates(坐标)
5. rating(评分)
6. address(地址)
7. icon/color(外观)
8. created(日期)
**推荐格式:**
```yaml
categories:
- "[[LLM Wiki]]"
- "[[Places]]" # 字符串格式Wikilink
type: place
- landmark # 小写,用连字符
loc:
- "[[Wuhan]]" # Wikilink到分类
coordinates:
- "30.5438" # 纬度字符串
- "114.3055" # 经度字符串
rating: 5
address: 湖北省武汉市武昌区蛇山西端
icon: 🏯
color: #d4a574
created: 2026-04-10
```
### 5.3 Base视图命名规范
| 视图类型 | 推荐命名 | 说明 |
|---------|---------|------|
| **map** | Location | 显示地点位置的地图 |
| **table** | Details | 详细信息表格 |
| **table** | Location Details | 按地区过滤的表格 |
| **table** | Related | 相关链接的笔记 |
### 5.4 嵌入模式
**Kyoto模式(推荐):**
```markdown
## Places
![[Templates/Bases/Map.base#Location]] # 主地图
![[Templates/Bases/Places.base#Location]] # 同地区地点
```
**独立Base模式(不推荐):**
```markdown
## Places
![[黄鹤楼.base]] # 独立的base文件
```
**原因:** 独立base文件难以维护,Kyoto模式使用共享的Places.base
### 5.5 坐标获取
| 方法 | 精度 | 坐标系 | 推荐度 |
|------|--------|--------|--------|
| Maps右键Copy coordinates | 高 | 自动 | ⭐⭐⭐ |
| 腾讯地图网页 | 高 | GCJ-02 | ⭐⭐ |
| 高德地图网页 | 高 | GCJ-02 | ⭐⭐ |
| 手机GPS | 最高 | WGS-84 | ⭐⭐⭐ |
**注意事项:**
- 国内使用GCJ-02(腾讯/高德)减少偏移
- Obsidian Maps不做坐标转换,保持一致
---
## 六、完整检查清单
### 6.1 创建前检查
- [ ] Places分类文件存在
- [ ] Places.base模板存在
- [ ] Map.base模板存在
- [ ] 瓦片代理已启动
### 6.2 创建后验证
- [ ] categories格式正确(`"[[Places]]"`
- [ ] coordinates格式正确(分两行字符串)
- [ ] loc使用Wikilink`"[[Wuhan]]"`
- [ ] icon和color已设置
- [ ] 中文地址无乱码
- [ ] Trips嵌入正确
- [ ] Places.base#Location嵌入正确
- [ ] Map.base#Location嵌入正确
### 6.3 功能验证
- [ ] Places.base#Location显示地图
- [ ] 地图上能看到标记点
- [ ] 标记点位置正确
- [ ] 点击标记能跳转到笔记
- [ ] 地图能缩放和拖动
---
## 七、快速参考
### Frontmatter完整示例
```yaml
---
categories:
- "[[LLM Wiki]]"
- "[[Places]]"
type: place
- landmark
- tower
loc:
- "[[Wuhan]]"
coordinates:
- "30.5438"
- "114.3055"
rating: 5
address: 湖北省武汉市武昌区蛇山西端
icon: 🏯
color: #d4a574
created: 2026-04-10
---
# 黄鹤楼
[内容...]
## Trips
![[Templates/Bases/Trips.base#Location]]
## Places
![[Templates/Bases/Map.base#Location]]
![[Templates/Bases/Places.base#Location]]
```
### Places.base Location视图配置
```yaml
- type: map
name: Location
filters:
and:
- list(loc).contains(this)
order:
- file.name
- type
- rating
- last
sort:
- property: rating
direction: DESC
coordinates: note.coordinates
markerIcon: note.icon
markerColor: note.color
defaultZoom: 12
```
---
## 八、关键要点回顾
1. **categories使用字符串格式** `"[[Places]]"`
2. **coordinates分两行字符串** `"lat"` 和 `"lng"`
3. **loc使用Wikilink格式** `"[[Wuhan]]"`
4. **Places.base需要Location地图视图**,配置`coordinates: note.coordinates`
5. **使用共享Base而非独立Base**,便于维护
6. **遵循Kyoto.md的结构模式**,保持一致性
7. **确保UTF-8编码**,避免中文乱码
8. **瓦片代理必须运行**,地图才能加载
## 相关资源
---
## 规范文档
详见 [[地点笔记文件生成流程总结]]
- [[Obsidian Maps选点建笔记操作指南]]
- [[Templates/Bases/Places.base]]
- [[Templates/Bases/Map.base]]
- [[References/Kyoto.md]]
- [[Categories/Places.md]]
---
创建于:2026-04-10