johnny-decimal-index-for-obsidian-with-dataview.md(文件已创建)
@@ -0,0 +1,48 @@ | |||
1 | + | # Johnny Decimal Index Generator for Obsidian with Dataview | |
2 | + | ||
3 | + | You will need to enable JavaScript Queries in the Dataview settings. | |
4 | + | ||
5 | + | ```dataviewjs | |
6 | + | let areas = dv.pages("").file.folder.groupBy(g=>g.split("/")[0]).filter(({ key }) => /^\d{2}-\d{2} /.test(key)) | |
7 | + | let output = '' | |
8 | + | areas.forEach(({ key: areaKey, rows: areaRows }) => { | |
9 | + | output += `\n- ${areaKey}` | |
10 | + | areaRows.groupBy(g => g.split("/")[1]).forEach(({ key: categoryKey, rows: categoryRows }) => { | |
11 | + | if (/^\d{2} /.test(categoryKey)) { | |
12 | + | output += `\n - ${categoryKey}` | |
13 | + | dv.pages(`"${areaKey}/${categoryKey}"`).file.forEach(({ link: contentKey }) => { | |
14 | + | output += `\n - ${contentKey}` | |
15 | + | }) | |
16 | + | } | |
17 | + | }) | |
18 | + | }) | |
19 | + | dv.paragraph(output) | |
20 | + | ``` | |
21 | + | ||
22 | + | ## Output | |
23 | + | ||
24 | + | - 00-09 System | |
25 | + | - 00 Index | |
26 | + | - [00.00 Index]() | |
27 | + | - 01 Inbox | |
28 | + | - [01.00 Inbox]() | |
29 | + | - [01.01 Scratchpad]() | |
30 | + | - 02 Notes | |
31 | + | - [02.00 Notes]() | |
32 | + | - 03 TODOs | |
33 | + | - [03.00 TODOs]() | |
34 | + | - 04 Bookmarks | |
35 | + | - [04.00 Bookmarks]() | |
36 | + | - 05 Templates | |
37 | + | - [05.00 Templates]() | |
38 | + | - 08 Someday | |
39 | + | - [08.00 Someday]() | |
40 | + | - 09 Archive | |
41 | + | - [09.00 Archive]() | |
42 | + | ||
43 | + | ||
44 | + | ## Links | |
45 | + | ||
46 | + | - [Johnny Decimal](https://johnnydecimal.com) | |
47 | + | - [Obsidian](https://obsidian.md) | |
48 | + | - [obsidian-dataview](https://github.com/blacksmithgu/obsidian-dataview) |
上一页
下一页