sieve-notes 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/CHANGELOG.md +19 -0
  2. {sieve_notes-0.3.0/sieve_notes.egg-info → sieve_notes-0.4.0}/PKG-INFO +60 -7
  3. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/README.ja.md +56 -4
  4. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/README.md +59 -6
  5. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/docs/formats.md +6 -3
  6. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/docs/plan.md +3 -1
  7. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/docs/resolution.md +1 -1
  8. sieve_notes-0.4.0/docs/tags.md +108 -0
  9. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/docs/vocabulary.md +20 -6
  10. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/examples/README.md +4 -1
  11. sieve_notes-0.4.0/examples/vault_tags/index.md +10 -0
  12. sieve_notes-0.4.0/examples/vault_tags/journal.md +3 -0
  13. sieve_notes-0.4.0/examples/vault_tags/notes/ideas.md +3 -0
  14. sieve_notes-0.4.0/examples/vault_tags/notes/meeting.md +9 -0
  15. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/pyproject.toml +1 -1
  16. {sieve_notes-0.3.0 → sieve_notes-0.4.0/sieve_notes.egg-info}/PKG-INFO +60 -7
  17. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/sieve_notes.egg-info/SOURCES.txt +5 -0
  18. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/sieve_notes.py +406 -29
  19. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/tests/test_notes_nt.py +1184 -44
  20. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/LICENSE +0 -0
  21. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/MANIFEST.in +0 -0
  22. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/conftest.py +0 -0
  23. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/docs/convert.md +0 -0
  24. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/docs/graph.md +0 -0
  25. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/examples/vault_mixed/meeting.md +0 -0
  26. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/examples/vault_mixed/overview.md +0 -0
  27. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/examples/vault_outline/meeting.md +0 -0
  28. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/examples/vault_outline/reading.md +0 -0
  29. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/examples/vault_wikilink/daily/2026-11-28.md +0 -0
  30. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/examples/vault_wikilink/ideas/plan.md +0 -0
  31. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/examples/vault_wikilink/index.md +0 -0
  32. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/setup.cfg +0 -0
  33. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/sieve_notes.egg-info/dependency_links.txt +0 -0
  34. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/sieve_notes.egg-info/entry_points.txt +0 -0
  35. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/sieve_notes.egg-info/top_level.txt +0 -0
  36. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/tests/public_text_baseline.json +0 -0
  37. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/tests/test_public_text.py +0 -0
  38. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/tools/check_public_text.py +0 -0
  39. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/tools/check_release_assets.py +0 -0
  40. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/tools/check_release_version.py +0 -0
  41. {sieve_notes-0.3.0 → sieve_notes-0.4.0}/tools/extract_changelog.py +0 -0
@@ -1,3 +1,22 @@
1
+ ## [0.4.0] - 2026-12-03
2
+
3
+ ### Added
4
+
5
+ - The `tags` command observes the tags of a vault: the `#tag` marks in note bodies (document and outline notes alike) and the `tags` lists in the frontmatter, counted per tag as `inline` and `frontmatter` with the note count and the occurrence count. `--notes` adds the per-note lists and `--no-names` replaces the tag names by `t1`, `t2`, ... Nothing is written.
6
+ - The `plan` rules accept the eighth predicate `tag:NAME`: a note matches when it carries the tag `NAME` or a nested tag below `NAME/` (for example `tag:inbox` matches `inbox` and `inbox/to-read`).
7
+
8
+ ### Fixed
9
+
10
+ - An outline that contains a fenced `code` block as a child item now converts to document and back without changing from the first result on (the code is restored as its own literal block, the same way `math` already is).
11
+
12
+ ## [0.3.1] - 2026-12-02
13
+
14
+ ### Fixed
15
+
16
+ - In the `graph` SVG (the `links` and `folders` views), every edge now starts on the boundary of its source node and ends on the boundary of its target node (within a pixel), so the arrowhead touches the target node instead of stopping short of it.
17
+ - An unknown `--format` for `index`, `blocks` and `convert` (for example `--format yaml`) now exits with the closed error word `invalid_option` and exit code 2, like every other invalid option. The valid outputs are unchanged.
18
+ - The version statements in `docs/formats.md` and `docs/resolution.md` show the current version.
19
+
1
20
  ## [0.3.0] - 2026-12-02
2
21
 
3
22
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sieve-notes
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Deterministic observation and conversion for Markdown note vaults: note relations, block trees, document-outline round trips, link graphs and placement plans
5
5
  Author: Kai IWASAKI
6
6
  License-Expression: MIT
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
  Dynamic: license-file
22
22
 
23
- # Sieve Notes v0.3.0
23
+ # Sieve Notes v0.4.0
24
24
 
25
25
  English | [日本語](https://github.com/neguseatama/sieve-notes/blob/main/README.ja.md)
26
26
 
@@ -37,6 +37,8 @@ note-taking app, called a vault below) and deterministically produces:
37
37
  for existing drawing tools (`dot`, `mermaid`) or for machines (`json`).
38
38
  5. **Placement and order plans** — where each note could be placed, and in
39
39
  which order the notes of a folder would stand, before anything is moved.
40
+ 6. **Tags** — how often each `#tag` mark and each frontmatter `tags` entry
41
+ is used, per tag and per note, as an observation.
40
42
 
41
43
  It runs on the standard library alone (no runtime dependencies).
42
44
  Python 3.10 or later. It works offline and sends no telemetry.
@@ -156,6 +158,53 @@ four path-form links of `index.md` would break, while the name-only
156
158
  `[[index]]` links of the moved notes keep working. `unmatched` counts the
157
159
  notes that no rule matched.
158
160
 
161
+ The tags of the bundled example vault (`examples/vault_tags`):
162
+
163
+ ```console
164
+ $ sieve-notes tags examples/vault_tags
165
+ notes 4
166
+ notes_with_tags 4
167
+ tags_distinct 7
168
+ tag_occurrences 12
169
+ frontmatter_ignored 0
170
+ excluded_dirs 0
171
+ skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
172
+ inbox notes=3 occurrences=4
173
+ planning notes=1 occurrences=2
174
+ work/deep notes=1 occurrences=2
175
+ daily notes=1 occurrences=1
176
+ inbox/read-later notes=1 occurrences=1
177
+ work notes=1 occurrences=1
178
+ 整理 notes=1 occurrences=1
179
+ ```
180
+
181
+ `tags` counts the `#tag` marks in the bodies and the `tags` lists in the
182
+ frontmatter, per tag (`inline` and `frontmatter` kept apart) and, with
183
+ `--notes`, per note. A `#` starts a tag at the line start or right after a
184
+ blank only — `(#x)` and `a#b` are text — a name is never digits only, and
185
+ the displayed name is the NFC casefolded form. With a rule
186
+ `tag:inbox => inbox`, `plan` moves the notes of a tag:
187
+
188
+ ```console
189
+ $ sieve-notes plan examples/vault_tags --rules rules.txt
190
+ notes 4
191
+ move 3
192
+ stay 0
193
+ unmatched 1
194
+ blocked_collision 0
195
+ links_before resolved=2 broken=0 ambiguous=0 fragment_missing=0
196
+ links_after resolved=2 broken=0 ambiguous=0 fragment_missing=0
197
+ move index.md -> inbox rule=1
198
+ move journal.md -> inbox rule=1
199
+ move notes/ideas.md -> inbox rule=1
200
+ ```
201
+
202
+ with `rules.txt`:
203
+
204
+ ```
205
+ tag:inbox => inbox
206
+ ```
207
+
159
208
  ```console
160
209
  $ sieve-notes blocks ./vault/notes/plan.md
161
210
  dialect document
@@ -201,12 +250,14 @@ It never overwrites an existing output file (exit code 2).
201
250
  - `sieve-notes plan PATH` — a placement or order plan
202
251
  (`--rules FILE`, `--order name|links|backlinks|heading|size`,
203
252
  `--order-file FILE`, `--reverse`, `--strict`).
253
+ - `sieve-notes tags PATH` — the tag counts
254
+ (`--notes`, `--no-names`, `--include-hidden-dirs`).
204
255
  - `sieve-notes --self-check` — verifies the bundled small sample
205
256
  (exit codes 0 / 1 / 2).
206
257
 
207
- From Python, the five functions `index_vault` / `block_tree` /
208
- `convert_text` / `graph_vault` / `plan_vault` return the same shape
209
- (`notes_version: 1`).
258
+ From Python, the six functions `index_vault` / `block_tree` /
259
+ `convert_text` / `graph_vault` / `plan_vault` / `tags_vault` return the
260
+ same shape (`notes_version: 1`).
210
261
 
211
262
  ## Supported formats
212
263
 
@@ -215,6 +266,7 @@ From Python, the five functions `index_vault` / `block_tree` /
215
266
  - Block references (the `((id))` form)
216
267
  - Comments (`%%…%%` and HTML comments)
217
268
  - Math (inline `$…$`, display `$$…$$`) — observed as ranges and counts; math bodies are never emitted
269
+ - Tags (`#tag` in bodies, `tags` in frontmatter) — observed as names and counts; a tag is a mark, its content is never interpreted
218
270
  - Properties (frontmatter and `key:: value` lines)
219
271
  - Callouts (including folded `> [!x]-`)
220
272
  - File placement and folder layout (default exclusions:
@@ -226,8 +278,9 @@ The sources per format and the rules of this version live in docs:
226
278
  `docs/vocabulary.md` (the closed vocabulary and the output contract),
227
279
  `docs/resolution.md` (the link resolution rules),
228
280
  `docs/convert.md` (the conversion rules and properties),
229
- `docs/graph.md` (the link graph) and
230
- `docs/plan.md` (the placement and order plans).
281
+ `docs/graph.md` (the link graph),
282
+ `docs/plan.md` (the placement and order plans) and
283
+ `docs/tags.md` (the tags and the `tag:` predicate).
231
284
 
232
285
  ## License
233
286
 
@@ -1,15 +1,16 @@
1
- # Sieve Notes v0.3.0
1
+ # Sieve Notes v0.4.0
2
2
 
3
3
  [English](https://github.com/neguseatama/sieve-notes/blob/main/README.md) | 日本語
4
4
 
5
5
  Markdown のノートを集めたフォルダ(ノート用アプリの保管庫。以下 vault)を
6
- 読み、次の 5 つを、決定論的に出すコマンドラインの道具です。
6
+ 読み、次の 6 つを、決定論的に出すコマンドラインの道具です。
7
7
 
8
8
  1. **ノートの関係の観測** — 一覧・リンク・被リンク・切れたリンク・孤立したノート。
9
9
  2. **ブロックの木** — 見出し・段落・リスト・コード・表などを、閉じた語彙の木に落とします(本文は出しません)。
10
10
  3. **ドキュメント ⇄ アウトラインの変換** — 構造木を介した純粋な変換。元のファイルは変えず、新しいファイルに書き出します。
11
11
  4. **リンク関係の図** — ノートのつながりを、図(`svg`)や、既存の描画ツール向けの文章(`dot`・`mermaid`)、機械向けの形(`json`)で出します。
12
12
  5. **置き場所と並び順の計画** — どのノートをどこに置けるか、各フォルダのノートがどんな順に並ぶかを、動かす前に出します。
13
+ 6. **タグ** — 本文の `#タグ` と frontmatter の `tags` が、タグごと・ノートごとに何回使われているかを、観測として出します。
13
14
 
14
15
  標準ライブラリだけで動きます(実行時の依存は 1 つもありません)。
15
16
  Python 3.10 以上。オフラインで動き、利用の記録を送りません。
@@ -127,6 +128,53 @@ name:plan => projects
127
128
  名前だけの `[[index]]` は切れません。`unmatched` は、どの規則にも
128
129
  合わなかったノートの件数です。
129
130
 
131
+ 同梱の例の vault(`examples/vault_tags`)のタグ:
132
+
133
+ ```console
134
+ $ sieve-notes tags examples/vault_tags
135
+ notes 4
136
+ notes_with_tags 4
137
+ tags_distinct 7
138
+ tag_occurrences 12
139
+ frontmatter_ignored 0
140
+ excluded_dirs 0
141
+ skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
142
+ inbox notes=3 occurrences=4
143
+ planning notes=1 occurrences=2
144
+ work/deep notes=1 occurrences=2
145
+ daily notes=1 occurrences=1
146
+ inbox/read-later notes=1 occurrences=1
147
+ work notes=1 occurrences=1
148
+ 整理 notes=1 occurrences=1
149
+ ```
150
+
151
+ `tags` は、本文の `#タグ` と frontmatter の `tags` のリストを数えます。
152
+ タグごとに `inline` と `frontmatter` を分けて数え、`--notes` で
153
+ ノートごとの一覧も出します。`#` がタグになるのは行頭か空白の直後だけ
154
+ (`(#x)` や `a#b` は本文のまま)、名前が数字だけでもタグではなく、
155
+ 出す名前は NFC・casefold の形です。規則 `tag:inbox => inbox` で、
156
+ `plan` はタグのノートの置き場所を出せます:
157
+
158
+ ```console
159
+ $ sieve-notes plan examples/vault_tags --rules rules.txt
160
+ notes 4
161
+ move 3
162
+ stay 0
163
+ unmatched 1
164
+ blocked_collision 0
165
+ links_before resolved=2 broken=0 ambiguous=0 fragment_missing=0
166
+ links_after resolved=2 broken=0 ambiguous=0 fragment_missing=0
167
+ move index.md -> inbox rule=1
168
+ move journal.md -> inbox rule=1
169
+ move notes/ideas.md -> inbox rule=1
170
+ ```
171
+
172
+ `rules.txt` の中身:
173
+
174
+ ```
175
+ tag:inbox => inbox
176
+ ```
177
+
130
178
  ```console
131
179
  $ sieve-notes blocks ./vault/notes/plan.md
132
180
  dialect document
@@ -172,11 +220,13 @@ output plan-outline.md
172
220
  - `sieve-notes plan PATH` — 置き場所と並び順の計画
173
221
  (`--rules FILE`、`--order name|links|backlinks|heading|size`、
174
222
  `--order-file FILE`、`--reverse`、`--strict`)。
223
+ - `sieve-notes tags PATH` — タグの件数
224
+ (`--notes`、`--no-names`、`--include-hidden-dirs`)。
175
225
  - `sieve-notes --self-check` — 同梱の小さな試料で、観測と変換が
176
226
  期待どおりか確かめます(終了符号 0 / 1 / 2)。
177
227
 
178
228
  Python からは `index_vault` / `block_tree` / `convert_text` /
179
- `graph_vault` / `plan_vault` の 5 つの関数が同じ形
229
+ `graph_vault` / `plan_vault` / `tags_vault` の 6 つの関数が同じ形
180
230
  (`notes_version: 1`)を返します。
181
231
 
182
232
  ## 対応する書式
@@ -186,6 +236,7 @@ Python からは `index_vault` / `block_tree` / `convert_text` /
186
236
  - ブロックの参照(`((id))` の形)
187
237
  - コメント(`%%…%%` と HTML コメント)
188
238
  - 数式(インライン `$…$`、表示 `$$…$$`)— 範囲と件数を観測します(本文は出しません)
239
+ - タグ(本文の `#タグ` と frontmatter の `tags`)— 名前と件数を観測します(タグは印で、中身は解釈しません)
189
240
  - プロパティ(frontmatter と `key:: value` の行)
190
241
  - コールアウト(折りたたみ `> [!x]-` を含む)
191
242
  - ファイルの置き場所とフォルダの構成(既定の除外:
@@ -198,7 +249,8 @@ Python からは `index_vault` / `block_tree` / `convert_text` /
198
249
  `docs/resolution.md`(リンクの解決の規則)・
199
250
  `docs/convert.md`(変換の規則と性質)・
200
251
  `docs/graph.md`(リンク関係の図)・
201
- `docs/plan.md`(置き場所と並び順の計画)。
252
+ `docs/plan.md`(置き場所と並び順の計画)・
253
+ `docs/tags.md`(タグと `tag:` 述語)。
202
254
 
203
255
  ## ライセンス
204
256
 
@@ -1,4 +1,4 @@
1
- # Sieve Notes v0.3.0
1
+ # Sieve Notes v0.4.0
2
2
 
3
3
  English | [日本語](https://github.com/neguseatama/sieve-notes/blob/main/README.ja.md)
4
4
 
@@ -15,6 +15,8 @@ note-taking app, called a vault below) and deterministically produces:
15
15
  for existing drawing tools (`dot`, `mermaid`) or for machines (`json`).
16
16
  5. **Placement and order plans** — where each note could be placed, and in
17
17
  which order the notes of a folder would stand, before anything is moved.
18
+ 6. **Tags** — how often each `#tag` mark and each frontmatter `tags` entry
19
+ is used, per tag and per note, as an observation.
18
20
 
19
21
  It runs on the standard library alone (no runtime dependencies).
20
22
  Python 3.10 or later. It works offline and sends no telemetry.
@@ -134,6 +136,53 @@ four path-form links of `index.md` would break, while the name-only
134
136
  `[[index]]` links of the moved notes keep working. `unmatched` counts the
135
137
  notes that no rule matched.
136
138
 
139
+ The tags of the bundled example vault (`examples/vault_tags`):
140
+
141
+ ```console
142
+ $ sieve-notes tags examples/vault_tags
143
+ notes 4
144
+ notes_with_tags 4
145
+ tags_distinct 7
146
+ tag_occurrences 12
147
+ frontmatter_ignored 0
148
+ excluded_dirs 0
149
+ skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
150
+ inbox notes=3 occurrences=4
151
+ planning notes=1 occurrences=2
152
+ work/deep notes=1 occurrences=2
153
+ daily notes=1 occurrences=1
154
+ inbox/read-later notes=1 occurrences=1
155
+ work notes=1 occurrences=1
156
+ 整理 notes=1 occurrences=1
157
+ ```
158
+
159
+ `tags` counts the `#tag` marks in the bodies and the `tags` lists in the
160
+ frontmatter, per tag (`inline` and `frontmatter` kept apart) and, with
161
+ `--notes`, per note. A `#` starts a tag at the line start or right after a
162
+ blank only — `(#x)` and `a#b` are text — a name is never digits only, and
163
+ the displayed name is the NFC casefolded form. With a rule
164
+ `tag:inbox => inbox`, `plan` moves the notes of a tag:
165
+
166
+ ```console
167
+ $ sieve-notes plan examples/vault_tags --rules rules.txt
168
+ notes 4
169
+ move 3
170
+ stay 0
171
+ unmatched 1
172
+ blocked_collision 0
173
+ links_before resolved=2 broken=0 ambiguous=0 fragment_missing=0
174
+ links_after resolved=2 broken=0 ambiguous=0 fragment_missing=0
175
+ move index.md -> inbox rule=1
176
+ move journal.md -> inbox rule=1
177
+ move notes/ideas.md -> inbox rule=1
178
+ ```
179
+
180
+ with `rules.txt`:
181
+
182
+ ```
183
+ tag:inbox => inbox
184
+ ```
185
+
137
186
  ```console
138
187
  $ sieve-notes blocks ./vault/notes/plan.md
139
188
  dialect document
@@ -179,12 +228,14 @@ It never overwrites an existing output file (exit code 2).
179
228
  - `sieve-notes plan PATH` — a placement or order plan
180
229
  (`--rules FILE`, `--order name|links|backlinks|heading|size`,
181
230
  `--order-file FILE`, `--reverse`, `--strict`).
231
+ - `sieve-notes tags PATH` — the tag counts
232
+ (`--notes`, `--no-names`, `--include-hidden-dirs`).
182
233
  - `sieve-notes --self-check` — verifies the bundled small sample
183
234
  (exit codes 0 / 1 / 2).
184
235
 
185
- From Python, the five functions `index_vault` / `block_tree` /
186
- `convert_text` / `graph_vault` / `plan_vault` return the same shape
187
- (`notes_version: 1`).
236
+ From Python, the six functions `index_vault` / `block_tree` /
237
+ `convert_text` / `graph_vault` / `plan_vault` / `tags_vault` return the
238
+ same shape (`notes_version: 1`).
188
239
 
189
240
  ## Supported formats
190
241
 
@@ -193,6 +244,7 @@ From Python, the five functions `index_vault` / `block_tree` /
193
244
  - Block references (the `((id))` form)
194
245
  - Comments (`%%…%%` and HTML comments)
195
246
  - Math (inline `$…$`, display `$$…$$`) — observed as ranges and counts; math bodies are never emitted
247
+ - Tags (`#tag` in bodies, `tags` in frontmatter) — observed as names and counts; a tag is a mark, its content is never interpreted
196
248
  - Properties (frontmatter and `key:: value` lines)
197
249
  - Callouts (including folded `> [!x]-`)
198
250
  - File placement and folder layout (default exclusions:
@@ -204,8 +256,9 @@ The sources per format and the rules of this version live in docs:
204
256
  `docs/vocabulary.md` (the closed vocabulary and the output contract),
205
257
  `docs/resolution.md` (the link resolution rules),
206
258
  `docs/convert.md` (the conversion rules and properties),
207
- `docs/graph.md` (the link graph) and
208
- `docs/plan.md` (the placement and order plans).
259
+ `docs/graph.md` (the link graph),
260
+ `docs/plan.md` (the placement and order plans) and
261
+ `docs/tags.md` (the tags and the `tag:` predicate).
209
262
 
210
263
  ## License
211
264
 
@@ -1,6 +1,6 @@
1
1
  # Supported formats and sources
2
2
 
3
- The formats that Sieve Notes 0.2.0 covers, with their sources (official
3
+ The formats that Sieve Notes 0.4.0 covers, with their sources (official
4
4
  documentation). Formats are described by the name of the format itself. A
5
5
  format that could not be confirmed in official documentation is listed under
6
6
  "Not covered" and is not implemented in this version.
@@ -13,6 +13,7 @@ format that could not be confirmed in official documentation is listed under
13
13
  | Callouts (including folded `> [!faq]-` and default-open `+`) | Callouts — https://obsidian.md/help/callouts |
14
14
  | Comments `%%…%%` (inline and block) and HTML comments `<!--…-->` | Comments in Obsidian Flavored Markdown — https://help.obsidian.md/syntax |
15
15
  | Math (inline `$…$`, display `$$…$$`) — observed as ranges and counts; the formulas are not interpreted or rendered | Math — https://help.obsidian.md/syntax |
16
+ | Tags (`#tag`, nested `#a/b`, the `tags` list in frontmatter) — observed as names and counts (the `tags` command, the `tag:` predicate of `plan`); a tag is a mark, its content is not interpreted | Tags — https://obsidian.md/help/tags |
16
17
  | Properties (frontmatter: YAML between `---` lines) | Properties — https://obsidian.md/help/properties |
17
18
  | Vault and the settings folder `.obsidian/` | How Obsidian stores data — https://obsidian.md/help/data-storage |
18
19
  | Attachment locations (default, a given folder, the note's own folder, a subfolder of it) | Attachments — https://obsidian.md/help/attachments |
@@ -39,7 +40,9 @@ format that could not be confirmed in official documentation is listed under
39
40
  6. **Bullets starting with `+` or `*` inside blocks.** They appear in the
40
41
  official bullet page, but the list marker of this version is limited to
41
42
  `- `. Lines starting with `+` or `*` are treated as text (paragraphs).
42
- 7. **Tags (`#tag`, nested `#a/b`, `tags:` in frontmatter).** They appear in
43
- the official documentation, but this version does not observe tags.
43
+ 7. **Logseq tags (`#[[several words]]` and `tags:: a, b`).** Only the
44
+ `#tag` form of the official tag documentation and the frontmatter
45
+ `tags` list are observed; the other two spellings of the outliner form
46
+ are not (a `tags::` line carries no `#tag` mark).
44
47
 
45
48
  Obsidian and Logseq are trademarks of their respective owners. This project is not affiliated with or endorsed by them.
@@ -26,6 +26,7 @@ are `#` (with or without leading spaces) and blank lines are ignored:
26
26
  path:daily/* => journal
27
27
  property:type=book => books/read
28
28
  links-to:Index => indexed
29
+ tag:inbox => inbox
29
30
  orphan => inbox
30
31
  ```
31
32
 
@@ -34,7 +35,7 @@ top and the first match wins. The destination is a relative folder path with
34
35
  `/` separators (`.` is the root); the file name is never changed. A missing
35
36
  rules file is `input_not_found`.
36
37
 
37
- ### The seven predicates
38
+ ### The eight predicates
38
39
 
39
40
  | Predicate | Matches when |
40
41
  |---|---|
@@ -43,6 +44,7 @@ rules file is `input_not_found`.
43
44
  | `property:KEY=VALUE` | the note is a document-form note whose leading `---` block sets `KEY: VALUE` to the single string VALUE (whitespace and one pair of surrounding quotes are stripped; the comparison is case-insensitive). Lists, flow collections and empty values count as no value; outline-form notes never match |
44
45
  | `links-to:NAME` | the note holds at least one resolved link to the note that NAME resolves to (the same resolution as a wikilink). When NAME does not resolve to exactly one note, the predicate matches nothing |
45
46
  | `linked-from:NAME` | the note receives at least one resolved link from that note (same rule) |
47
+ | `tag:NAME` | the note carries the tag `NAME` or a nested tag below `NAME/` (`tag:inbox` matches `inbox` and `inbox/to-read`, not `inboxes`). NAME is read like a frontmatter item: one leading `#` and the trailing `/` are dropped, then NFC and casefold; the name must satisfy the tag name rules of `docs/tags.md`, otherwise the rule is `bad_syntax`. Both tag kinds count (body and frontmatter) |
46
48
  | `orphan` | the note has no incoming resolved links from other notes (the same definition as the orphan count of `index`) |
47
49
  | `any` | always |
48
50
 
@@ -1,6 +1,6 @@
1
1
  # Link resolution rules
2
2
 
3
- The rules by which Sieve Notes 0.1.0 resolves links. The official
3
+ The rules by which Sieve Notes 0.4.0 resolves links. The official
4
4
  documentation listed in `docs/formats.md` is the basis for these rules. Where
5
5
  the documentation is silent, the rule written here is the default.
6
6
 
@@ -0,0 +1,108 @@
1
+ # The tags of a vault (`tags`)
2
+
3
+ `tags PATH` observes the tags of a vault: which tags are used, how often,
4
+ and in how many notes. It is an observation: a tag is counted as a mark,
5
+ its content is never interpreted, and no file is written, moved or renamed.
6
+
7
+ ```
8
+ sieve_notes.py tags PATH [--notes] [--no-names] [--format text|json]
9
+ [--include-hidden-dirs]
10
+ ```
11
+
12
+ The vault walk, the default exclusions, the skip reasons and the error
13
+ words are the same as `index` (`input_not_found`, `not_a_directory`,
14
+ `invalid_option`; exit codes 0 / 2, and 1 is not used). There is no
15
+ `--strict`.
16
+
17
+ ## What is counted as a tag
18
+
19
+ Two sources, the tag kinds:
20
+
21
+ - `inline` — a `#tag` in the note body. The same rules for document-form
22
+ and outline-form notes.
23
+ - `frontmatter` — the `tags` list of the leading `---` block of a
24
+ document-form note. Outline-form notes never read a property.
25
+
26
+ The rules of the `#tag` form follow the official documentation
27
+ (https://obsidian.md/help/tags) and close the points it leaves open:
28
+
29
+ - A `#` starts a tag when it stands at the line start or right after a
30
+ blank (a character for which `str.isspace()` is true, so a full-width
31
+ space counts). A `#` in any other place — `a#b`, `(#x)`, `[t](#s)`, a
32
+ URL fragment, `\#x` — is not a tag. Link targets never carry a tag for
33
+ the same reason.
34
+ - The name continues over letters, marks and numbers (the Unicode
35
+ categories `L*`, `M*`, `N*`), the emoji symbol category (`So`), and `_`,
36
+ `-`, `/` (nesting). Everything else ends the tag: blanks, punctuation,
37
+ brackets, `。`.
38
+ - The trailing `/` is dropped (`#a/` counts as `a`).
39
+ - A name that is empty or digits only is not a tag (`#`, `#/` and `#1984`
40
+ are nothing; `#y1984`, `#2024-01`, `#-` and `#_` are tags).
41
+ - A tag is not counted inside a fenced code block or inline code, inside
42
+ math (`$…$` and `$$…$$`), inside a `%%…%%` comment, or inside the leading
43
+ `---` block (its `tags` list is read separately). Headings, quotes,
44
+ lists, tables and callouts count.
45
+ - A line that opens with a complete `%%…%%` pair counts as body text after
46
+ the pair. A `%%` line without a closing pair on the same line opens a
47
+ comment block; its lines (to the line that closes the block, or to the
48
+ end of the note) are not counted.
49
+
50
+ ## The frontmatter `tags` list
51
+
52
+ Two spellings are read (a document-form note only):
53
+
54
+ ```
55
+ tags:
56
+ - work
57
+ - work/deep
58
+ ```
59
+
60
+ ```
61
+ tags: [a, b/c]
62
+ ```
63
+
64
+ Each item is stripped of its surrounding whitespace, one pair of quotes
65
+ and one leading `#`; the trailing `/` is dropped. An item that then
66
+ satisfies the name rules is a `frontmatter` tag. An item that does not
67
+ (`1984`, `a b`, an empty item) is counted in `frontmatter_ignored` and is
68
+ not a tag. The other spellings (`tags: a, b`, `tags: a`, nested keys,
69
+ `tag:`, `Tags:`) are not read at all and change no count.
70
+
71
+ ## Names and counting
72
+
73
+ - A name is emitted normalized: NFC, then casefold (`#C` and `#c` are the
74
+ same tag, and so are `#ß` and `#SS`).
75
+ - Nesting is not summed up: `a` and `a/b` are two separate tags.
76
+ - Every appearance counts in `occurrences`; a note counts once in `notes`
77
+ per tag, however often it uses the tag there. The same tag in the body
78
+ and in the frontmatter counts for both kinds.
79
+
80
+ ## Output
81
+
82
+ The tags are ordered by descending occurrences, then ascending name (the
83
+ normalized name), then the first raw spelling seen. `--notes` lists every
84
+ scanned note in ascending path order — also the notes without tags, with
85
+ an empty list; the tags of one note are in ascending name order.
86
+ `--no-names` replaces every displayed tag name by `t1`, `t2`, ... in the
87
+ output order of the tag list; the per-note lists keep their order and
88
+ carry the same numbers, so nothing about the structure changes.
89
+
90
+ The text form starts with the totals (`notes`, `notes_with_tags`,
91
+ `tags_distinct`, `tag_occurrences`, `frontmatter_ignored`, `excluded_dirs`
92
+ and the `skipped` words), continues with one line per tag
93
+ (`name notes=N occurrences=O`) and, with `--notes`, one `note PATH` line
94
+ per note followed by the indented per-tag lines (` name occurrences=O`).
95
+
96
+ The JSON form carries `notes_version: 1`, `command: "tags"`, the `totals`
97
+ (the fields above, `skipped` with the same words as `index`), the `tags`
98
+ list (`name`, `notes`, `occurrences`, `inline`, `frontmatter`) and, with
99
+ `--notes`, `note_tags` (`path`, `tags` with `name` and `occurrences`).
100
+
101
+ ## The `tag:` predicate of `plan`
102
+
103
+ The rules file of `plan` accepts the predicate `tag:NAME`. A note matches
104
+ when it carries the tag `NAME` or a nested tag below `NAME/` (`tag:inbox`
105
+ matches `inbox` and `inbox/to-read`, not `inboxes`). The name is read like
106
+ a frontmatter item (one leading `#` and the trailing `/` are dropped, then
107
+ NFC and casefold) and must satisfy the name rules — otherwise the rule is
108
+ `bad_syntax`. Both kinds count, body and frontmatter. See `docs/plan.md`.
@@ -1,6 +1,6 @@
1
1
  # Closed vocabulary and output contract
2
2
 
3
- The words that appear in the output of Sieve Notes 0.3.0 are limited to the
3
+ The words that appear in the output of Sieve Notes 0.4.0 are limited to the
4
4
  closed lists below. No other word is emitted.
5
5
 
6
6
  ## Link kinds
@@ -115,10 +115,21 @@ The `graph` JSON carries `view`, `nodes` (`id`, `path`, `kind`, and
115
115
  `n1`, `n2`, ... in node order, shared by all formats; with `--no-names` the
116
116
  `path` value is the identifier. See `docs/graph.md`.
117
117
 
118
+ ## Tag words
119
+
120
+ - Tag kinds (exactly two): `inline` (a `#tag` in the body), `frontmatter`
121
+ (an item of the `tags` list of the leading `---` block).
122
+ - The `tags` JSON carries `tags` (`name`, `notes`, `occurrences`,
123
+ `inline`, `frontmatter`) and, with `--notes`, `note_tags`; the totals
124
+ carry `notes_with_tags`, `tags_distinct`, `tag_occurrences` and
125
+ `frontmatter_ignored`. The predicate of `plan` is `tag`.
126
+ - A tag name is emitted NFC, then casefold; nesting is not summed up. A
127
+ tag is a mark: its content is never interpreted. See `docs/tags.md`.
128
+
118
129
  ## Plan words
119
130
 
120
- - Predicates of the rules file (exactly seven): `name`, `path`, `property`,
121
- `links-to`, `linked-from`, `orphan`, `any`.
131
+ - Predicates of the rules file (exactly eight): `name`, `path`,
132
+ `property`, `links-to`, `linked-from`, `tag`, `orphan`, `any`.
122
133
  - Order keys (exactly five): `name`, `links`, `backlinks`, `heading`, `size`.
123
134
  - State words (exactly four): `move`, `stay`, `unmatched`,
124
135
  `blocked_collision`.
@@ -141,6 +152,7 @@ link-state words joined by `→`) and `changed_links` (`note`, `line`,
141
152
  - `graph`: **0 = emitted / 2 = cannot run** (1 is not used).
142
153
  - `plan`: 0 = printed / 1 = with `--strict` and `--rules`, at least one
143
154
  `move` or `blocked_collision` / 2 = cannot run.
155
+ - `tags`: **0 = printed / 2 = cannot run** (1 is not used).
144
156
 
145
157
  ## Output contract (`notes_version: 1`)
146
158
 
@@ -159,11 +171,13 @@ link-state words joined by `→`) and `changed_links` (`note`, `line`,
159
171
  - List of broken links: the note's relative path, line number, link kind and
160
172
  state word. Link target names are shown by default (intended for local
161
173
  use); `--no-names` omits the name field.
162
- - The public functions `graph_vault(path, ...)` and `plan_vault(path, ...)`
163
- return a dict in the same shape as the CLI (`graph_vault` additionally
164
- returns `output_text`, the rendered figure).
174
+ - The public functions `graph_vault(path, ...)`, `plan_vault(path, ...)`
175
+ and `tags_vault(path, ...)` return a dict in the same shape as the CLI
176
+ (`graph_vault` additionally returns `output_text`, the rendered
177
+ figure).
165
178
  - `graph` never writes a file without `-o`; with `-o` it writes exactly the
166
179
  one named new file. `plan` never writes a file and never moves one.
180
+ `tags` never writes a file.
167
181
  - Error words added in 0.3.0: `too_many_nodes` (the node count exceeds
168
182
  `--max-nodes`) and `invalid_rules` (a defective rules line; the error
169
183
  carries `line` and `reason`). The existing `input_not_found`,
@@ -1,6 +1,6 @@
1
1
  # Examples
2
2
 
3
- The three vaults in this folder are small, hand-made samples. They are not
3
+ The four vaults in this folder are small, hand-made samples. They are not
4
4
  output of a real note-taking application.
5
5
 
6
6
  - `vault_wikilink/` — a vault in the wikilink form (aliases, headings, block
@@ -10,6 +10,8 @@ output of a real note-taking application.
10
10
  `- ` bullet; `id:: <value>`, `collapsed:: true`, `((id))` block references,
11
11
  block properties and inline `%%…%%` comments).
12
12
  - `vault_mixed/` — a vault that mixes both forms.
13
+ - `vault_tags/` — a small vault for the `tags` command (inline `#tag` marks
14
+ and frontmatter `tags` lists, nesting and a Japanese tag).
13
15
 
14
16
  Try them:
15
17
 
@@ -17,6 +19,7 @@ Try them:
17
19
  $ python sieve_notes.py index examples/vault_wikilink
18
20
  $ python sieve_notes.py blocks examples/vault_outline/meeting.md
19
21
  $ python sieve_notes.py convert examples/vault_mixed/overview.md --to outline -o overview-outline.md
22
+ $ python sieve_notes.py tags examples/vault_tags
20
23
  ```
21
24
 
22
25
  The sample used by `--self-check` is not in this folder. It is bundled as
@@ -0,0 +1,10 @@
1
+ ---
2
+ tags: [planning, inbox]
3
+ ---
4
+
5
+ # 索引
6
+
7
+ 整理の考えは #inbox と #planning。
8
+
9
+ - [[notes/meeting]]
10
+ - [[journal]]
@@ -0,0 +1,3 @@
1
+ - きょう
2
+ - #daily の記録
3
+ - inbox の見直し #inbox
@@ -0,0 +1,3 @@
1
+ # アイデア
2
+
3
+ 読み返すのは #inbox/read-later と #inbox。整理の種は #整理。
@@ -0,0 +1,9 @@
1
+ ---
2
+ tags:
3
+ - work
4
+ - work/deep
5
+ ---
6
+
7
+ # 打ち合わせ
8
+
9
+ 次の一手は #work/deep で考える。
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sieve-notes"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "Deterministic observation and conversion for Markdown note vaults: note relations, block trees, document-outline round trips, link graphs and placement plans"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Kai IWASAKI" }]