#知识管理能力 #卡片盒笔记法 #数字花园 #编码 #方法论
基本信息
简介::基于[[卡片盒笔记法]],建立卡片之间的连接,当然可以使用[[MOC]],也可以使用编码
卢曼的卡片盒,使用的是实体:通过主题箱子和编码系统进行组织,如果这套系统移植到数字化系统上,那就是:索引+卡片盒+编码
编码体系
- 第一位是大类
- 第二位是大类的分支
- 第三位是排序位,使用数字
案例:1.1.1
利用的原理
- 黄金圈思维:Why,How,what
- 道术器
- 知行合一
编码体系
/* setTitleFromFilename.js */
async function setTitleFromFilename() {
const file = app.workspace.getActiveFile();
if (!file) return;
/* ===== 排除指定文件 ===== */
if (['Inbox', '待办记录.components'].includes(file.basename)) return;
/* ========== 1. 读取并标准化标签 ========== */
const cache = app.metadataCache.getFileCache(file);
const rawTags = cache?.frontmatter?.tags ?? cache?.frontmatter?.tag ?? [];
const tags = Array.isArray(rawTags)
? rawTags.map(t => String(t).toLowerCase())
: [String(rawTags).toLowerCase()];
/* ========== 2. 标签 → 前缀 映射表(按优先级排序) ========== */
const tagRules = [
{ match: ['清单'], prefix: '7.1' },
{ match: ['人物', '角色'], prefix: '3.1' },
{ match: ['企业'], prefix: '1.1' },
{ match: ['记录'], prefix: '1.4' },
{ match: ['酷口家数字花园'], prefix: '0.0' },
{ match: ['思维模型'], prefix: '2.1' },
{ match: ['技术'], prefix: '2.2' },
{ match: ['城市', '地名'], prefix: '4.1' },
{ match: ['app','法宝'], prefix: '5.1' },
{ match: ['灵兽'], prefix: '5.2' },
{ match: ['功法'], prefix: '5.3' },
{ match: ['上线记录'], prefix: '8.2' },
{ match: ['攻略'], prefix: '6.1' },
{ match: ['法宝'], prefix: '5.1' },
{ match: ['门派'], prefix: '3.2' },
{ match: ['方法论'], prefix: '2.2' },
{ match: ['参考资料','书名'], prefix: '9.1' },
{ match: ['自媒体'], prefix: '9.2' },
{ match: ['剪藏记录'], prefix: '9.3' },
{ match: ['插件'], prefix: '5.2' },
{ match: ['行业'], prefix: '1.0' }
];
/* ========== 3. 根据标签确定前缀(命中即停) ========== */
let prefixBase = '8.1';
for (const rule of tagRules) {
if (rule.match.some(k => tags.includes(k))) {
prefixBase = rule.prefix;
break;
}
}
/* ========== 4. 拼完整前缀:基础 + 年月日 ========== */
const today = new Date();
const y = today.getFullYear();
const m = String(today.getMonth() + 1).padStart(2, '0');
const d = String(today.getDate()).padStart(2, '0');
const datePart = `${y}${m}${d}`;
const datePrefix = `${prefixBase}.${datePart}`;
/* ========== 5. 处理 title ========== */
const currentTitle = String(cache?.frontmatter?.title ?? '').trim();
const shouldPrefix = prefixBase; // 不含日期
const shouldFull = `${prefixBase}.${datePart}`; // 含今天日期
const parts = currentTitle.match(/^([\d.]+)\s*(.*)$/);
const oldPrefixRaw = parts ? parts[1] : '';
const body = parts ? parts[2] : (currentTitle || file.basename);
// 只取前两段,忽略第三段及以后
const pureOld = oldPrefixRaw.replace(/\.\d{8}$/, '').split('.').slice(0, 2).join('.');
let newTitle = '';
if (pureOld !== shouldPrefix) {
// 规则1:标签不一致 → 重拼
newTitle = `${shouldFull} ${body.trim()}`;
} else if (/^\d$/.test(pureOld)) {
// 规则2:单数字且一致 → 重拼
newTitle = `${shouldFull} ${body.trim()}`;
} else {
// 规则3:X.X.X 且一致 → 仅补空格
newTitle = `${oldPrefixRaw} ${body.trim()}`;
}
if (newTitle !== currentTitle) {
await app.fileManager.processFrontMatter(file, fm => fm.title = newTitle);
new Notice(`✅ 已更新:${newTitle}`);
}
/* ========== 6. 写回 frontmatter ========== */
await app.fileManager.processFrontMatter(file, fm => {
fm.title = newTitle;
});
new Notice(`✅ title 已更新:${newTitle}`);
}
module.exports = setTitleFromFilename;
ob地址:笔记
推荐文章
- 2.2.20250720 编码 (0.933)
- 2思维模型-GTD (0.768)
- 8.1.20250715 Obsidian插件实现YAML标题更新 (0.684)
- 8.1.20250720 不同标签的编码逻辑 (0.652)
- 8.1.20250720 “000”开头的笔记编码规则调整 (0.634)
- 9.1.20250722 快刀青衣:Get笔记最新功能与AI时代竞争策略解析 (RANDOM - 0.500)