sieve-notes 0.1.0__tar.gz → 0.3.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.
- sieve_notes-0.3.0/CHANGELOG.md +31 -0
- {sieve_notes-0.1.0/sieve_notes.egg-info → sieve_notes-0.3.0}/PKG-INFO +124 -10
- sieve_notes-0.3.0/README.ja.md +207 -0
- sieve_notes-0.3.0/README.md +214 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/docs/convert.md +8 -6
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/docs/formats.md +6 -2
- sieve_notes-0.3.0/docs/graph.md +99 -0
- sieve_notes-0.3.0/docs/plan.md +139 -0
- sieve_notes-0.3.0/docs/vocabulary.md +170 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/pyproject.toml +2 -2
- {sieve_notes-0.1.0 → sieve_notes-0.3.0/sieve_notes.egg-info}/PKG-INFO +124 -10
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/sieve_notes.egg-info/SOURCES.txt +2 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/sieve_notes.py +1521 -16
- sieve_notes-0.3.0/tests/test_notes_nt.py +3025 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/tests/test_public_text.py +2 -0
- sieve_notes-0.3.0/tools/check_release_assets.py +126 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/tools/check_release_version.py +25 -10
- sieve_notes-0.1.0/CHANGELOG.md +0 -8
- sieve_notes-0.1.0/README.ja.md +0 -97
- sieve_notes-0.1.0/README.md +0 -100
- sieve_notes-0.1.0/docs/vocabulary.md +0 -93
- sieve_notes-0.1.0/tests/test_notes_nt.py +0 -1013
- sieve_notes-0.1.0/tools/check_release_assets.py +0 -68
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/LICENSE +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/MANIFEST.in +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/conftest.py +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/docs/resolution.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/examples/README.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/examples/vault_mixed/meeting.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/examples/vault_mixed/overview.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/examples/vault_outline/meeting.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/examples/vault_outline/reading.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/examples/vault_wikilink/daily/2026-11-28.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/examples/vault_wikilink/ideas/plan.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/examples/vault_wikilink/index.md +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/setup.cfg +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/sieve_notes.egg-info/dependency_links.txt +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/sieve_notes.egg-info/entry_points.txt +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/sieve_notes.egg-info/top_level.txt +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/tests/public_text_baseline.json +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/tools/check_public_text.py +0 -0
- {sieve_notes-0.1.0 → sieve_notes-0.3.0}/tools/extract_changelog.py +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
## [0.3.0] - 2026-12-02
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- `graph` draws the link graph of a vault: the `links` view (resolved note-to-note links, merged per direction with a link count), the `folders` view (aggregated per folder, `--depth`) and the `tree` view (folders and notes), each emitted as `svg`, `dot`, `mermaid` or `json`. The same input always produces the same bytes.
|
|
6
|
+
- The `graph` SVG is a static picture: no scripts, no external references, no absolute paths, black on white, with `<title>` and `<desc>`. `--no-names` replaces every display name by the shared node identifiers (`n1`, `n2`, ...).
|
|
7
|
+
- `plan` prints a placement plan from a small rules file (`--rules FILE`) (one rule per line, seven predicates, first match wins) and reports how every link of the vault would resolve after the planned moves (counts before and after, the changed links, and the state transitions). It only plans: nothing is moved, renamed or written.
|
|
8
|
+
- `plan` also ranks the notes of each folder: `--order KEY` (five keys) or a reference order (`--order-file FILE`); `--reverse` flips the direction.
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2026-12-01
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Math is observed: display math (`$$…$$`) is a `math` block in `blocks`, and `index` reports the `math_blocks` and `math_inline` counts for the whole vault and for each note. Math bodies are never emitted.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Links, comments and block references inside math are no longer counted; 0.1.0 counted them. The same symbols outside math are counted as before.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- The supported-formats list no longer claims tags (0.1.0 does not observe tags), and math is added to the list.
|
|
23
|
+
|
|
24
|
+
## [0.1.0] - 2026-11-29
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- `index` observes the relations of a Markdown vault deterministically: notes, links, backlinks, broken links and orphan notes.
|
|
29
|
+
- `blocks` prints the structure of a note as a tree over a closed vocabulary (headings, paragraphs, lists, code, tables and more). Note bodies are not emitted.
|
|
30
|
+
- `convert` converts between the document form and the outliner form. It writes a new file and never modifies the original.
|
|
31
|
+
- `--self-check` verifies observation and conversion against a small bundled sample.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sieve-notes
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Deterministic observation and conversion for Markdown note vaults: note relations, block trees,
|
|
3
|
+
Version: 0.3.0
|
|
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
|
|
7
7
|
Project-URL: Homepage, https://github.com/neguseatama/sieve-notes
|
|
@@ -20,7 +20,9 @@ Description-Content-Type: text/markdown
|
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
|
-
# Sieve Notes v0.
|
|
23
|
+
# Sieve Notes v0.3.0
|
|
24
|
+
|
|
25
|
+
English | [日本語](https://github.com/neguseatama/sieve-notes/blob/main/README.ja.md)
|
|
24
26
|
|
|
25
27
|
A command-line tool that reads a folder of Markdown notes (the vault of a
|
|
26
28
|
note-taking app, called a vault below) and deterministically produces:
|
|
@@ -31,6 +33,10 @@ note-taking app, called a vault below) and deterministically produces:
|
|
|
31
33
|
lowered into one closed vocabulary (no note bodies are emitted).
|
|
32
34
|
3. **Document ⇄ outline conversion** — a pure conversion through the tree.
|
|
33
35
|
The original file is never modified; the result goes to a new file.
|
|
36
|
+
4. **The link graph** — the note relations as a picture (`svg`) or as text
|
|
37
|
+
for existing drawing tools (`dot`, `mermaid`) or for machines (`json`).
|
|
38
|
+
5. **Placement and order plans** — where each note could be placed, and in
|
|
39
|
+
which order the notes of a folder would stand, before anything is moved.
|
|
34
40
|
|
|
35
41
|
It runs on the standard library alone (no runtime dependencies).
|
|
36
42
|
Python 3.10 or later. It works offline and sends no telemetry.
|
|
@@ -45,20 +51,119 @@ link_states resolved=5 broken=1 ambiguous=0 fragment_missing=1
|
|
|
45
51
|
orphan_notes 1
|
|
46
52
|
excluded_dirs 2
|
|
47
53
|
skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
|
|
48
|
-
|
|
54
|
+
math_blocks 2
|
|
55
|
+
math_inline 3
|
|
56
|
+
note a.md resolved=2 broken=1 ambiguous=0 fragment_missing=0 backlinks=1 collapsed=1 comments=2 math_blocks=1 math_inline=2
|
|
49
57
|
broken a.md:7 wikilink broken ghost
|
|
50
58
|
```
|
|
51
59
|
|
|
52
60
|
`index` observes the relations of the whole vault. For machines use
|
|
53
61
|
`--format json` (the `notes_version: 1` contract).
|
|
54
62
|
|
|
63
|
+
The graph of the bundled example vault (`examples/vault_wikilink`), drawn by
|
|
64
|
+
`graph` itself:
|
|
65
|
+
|
|
66
|
+

|
|
67
|
+
|
|
68
|
+
```console
|
|
69
|
+
$ sieve-notes graph ./vault --view links --format json
|
|
70
|
+
{
|
|
71
|
+
"command": "graph",
|
|
72
|
+
"edges": [
|
|
73
|
+
{
|
|
74
|
+
"from": "n1",
|
|
75
|
+
"links": 1,
|
|
76
|
+
"to": "n3"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"from": "n2",
|
|
80
|
+
"links": 1,
|
|
81
|
+
"to": "n3"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"from": "n3",
|
|
85
|
+
"links": 1,
|
|
86
|
+
"to": "n1"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"from": "n3",
|
|
90
|
+
"links": 3,
|
|
91
|
+
"to": "n2"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"exit_code": 0,
|
|
95
|
+
"nodes": [
|
|
96
|
+
{
|
|
97
|
+
"id": "n1",
|
|
98
|
+
"kind": "note",
|
|
99
|
+
"path": "daily/2026-11-28.md"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "n2",
|
|
103
|
+
"kind": "note",
|
|
104
|
+
"path": "ideas/plan.md"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "n3",
|
|
108
|
+
"kind": "note",
|
|
109
|
+
"path": "index.md"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"notes_version": 1,
|
|
113
|
+
"totals": {
|
|
114
|
+
"edges": 4,
|
|
115
|
+
"links_outside_scope": 0,
|
|
116
|
+
"nodes": 3
|
|
117
|
+
},
|
|
118
|
+
"view": "links"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`graph` shows the same relations as a picture or text. The nodes are `n1`,
|
|
123
|
+
`n2`, ... in a fixed order, the same in every format, so the picture and the
|
|
124
|
+
JSON can be joined. `--no-names` shares the structure without the note
|
|
125
|
+
names, and `--max-nodes` (default 200) stops with an error instead of
|
|
126
|
+
drawing a huge graph.
|
|
127
|
+
|
|
128
|
+
```console
|
|
129
|
+
$ sieve-notes plan ./vault --rules rules.txt
|
|
130
|
+
notes 3
|
|
131
|
+
move 2
|
|
132
|
+
stay 0
|
|
133
|
+
unmatched 1
|
|
134
|
+
blocked_collision 0
|
|
135
|
+
links_before resolved=8 broken=1 ambiguous=0 fragment_missing=0
|
|
136
|
+
links_after resolved=4 broken=5 ambiguous=0 fragment_missing=0
|
|
137
|
+
transitions resolved→broken=4
|
|
138
|
+
move daily/2026-11-28.md -> journal rule=1
|
|
139
|
+
move ideas/plan.md -> projects rule=2
|
|
140
|
+
changed index.md:3 wikilink from=daily/2026-11-28.md to=-
|
|
141
|
+
changed index.md:4 wikilink from=ideas/plan.md to=-
|
|
142
|
+
changed index.md:5 wikilink from=ideas/plan.md to=-
|
|
143
|
+
changed index.md:8 markdown_link from=ideas/plan.md to=-
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
with `rules.txt`:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
path:daily/* => journal
|
|
150
|
+
name:plan => projects
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`plan` only plans: nothing is moved, renamed or written. The report tells
|
|
154
|
+
you what would happen to the links if the moves were carried out — here the
|
|
155
|
+
four path-form links of `index.md` would break, while the name-only
|
|
156
|
+
`[[index]]` links of the moved notes keep working. `unmatched` counts the
|
|
157
|
+
notes that no rule matched.
|
|
158
|
+
|
|
55
159
|
```console
|
|
56
160
|
$ sieve-notes blocks ./vault/notes/plan.md
|
|
57
161
|
dialect document
|
|
58
162
|
block frontmatter depth=0 lines=1-3
|
|
59
163
|
block heading depth=0 lines=4-4
|
|
60
164
|
block paragraph depth=1 lines=6-7
|
|
61
|
-
block
|
|
165
|
+
block math depth=1 lines=9-12
|
|
166
|
+
block list_item depth=2 lines=14-14
|
|
62
167
|
...
|
|
63
168
|
```
|
|
64
169
|
|
|
@@ -90,11 +195,18 @@ It never overwrites an existing output file (exit code 2).
|
|
|
90
195
|
`--dialect auto|document|outline` selects the dialect.
|
|
91
196
|
- `sieve-notes convert FILE --to outline|document -o OUT` — conversion.
|
|
92
197
|
`--indent tab|2|4` selects the item indentation (the default is two spaces).
|
|
198
|
+
- `sieve-notes graph PATH` — the link graph
|
|
199
|
+
(`--view links|folders|tree`, `--format svg|dot|mermaid|json`,
|
|
200
|
+
`--scope DIR`, `--depth N`, `--max-nodes N`, `--no-names`, `-o FILE`).
|
|
201
|
+
- `sieve-notes plan PATH` — a placement or order plan
|
|
202
|
+
(`--rules FILE`, `--order name|links|backlinks|heading|size`,
|
|
203
|
+
`--order-file FILE`, `--reverse`, `--strict`).
|
|
93
204
|
- `sieve-notes --self-check` — verifies the bundled small sample
|
|
94
205
|
(exit codes 0 / 1 / 2).
|
|
95
206
|
|
|
96
|
-
From Python, the
|
|
97
|
-
`convert_text` return the same shape
|
|
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`).
|
|
98
210
|
|
|
99
211
|
## Supported formats
|
|
100
212
|
|
|
@@ -102,9 +214,9 @@ From Python, the three functions `index_vault` / `block_tree` /
|
|
|
102
214
|
- Markdown-form relative-path links
|
|
103
215
|
- Block references (the `((id))` form)
|
|
104
216
|
- Comments (`%%…%%` and HTML comments)
|
|
217
|
+
- Math (inline `$…$`, display `$$…$$`) — observed as ranges and counts; math bodies are never emitted
|
|
105
218
|
- Properties (frontmatter and `key:: value` lines)
|
|
106
219
|
- Callouts (including folded `> [!x]-`)
|
|
107
|
-
- Tags
|
|
108
220
|
- File placement and folder layout (default exclusions:
|
|
109
221
|
`.obsidian/`, `.trash/`, `logseq/`, `.git/`)
|
|
110
222
|
- Indentation characters (one tab or two spaces per level)
|
|
@@ -112,8 +224,10 @@ From Python, the three functions `index_vault` / `block_tree` /
|
|
|
112
224
|
The sources per format and the rules of this version live in docs:
|
|
113
225
|
`docs/formats.md` (supported formats and their official sources),
|
|
114
226
|
`docs/vocabulary.md` (the closed vocabulary and the output contract),
|
|
115
|
-
`docs/resolution.md` (the link resolution rules)
|
|
116
|
-
`docs/convert.md` (the conversion rules and properties)
|
|
227
|
+
`docs/resolution.md` (the link resolution rules),
|
|
228
|
+
`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).
|
|
117
231
|
|
|
118
232
|
## License
|
|
119
233
|
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Sieve Notes v0.3.0
|
|
2
|
+
|
|
3
|
+
[English](https://github.com/neguseatama/sieve-notes/blob/main/README.md) | 日本語
|
|
4
|
+
|
|
5
|
+
Markdown のノートを集めたフォルダ(ノート用アプリの保管庫。以下 vault)を
|
|
6
|
+
読み、次の 5 つを、決定論的に出すコマンドラインの道具です。
|
|
7
|
+
|
|
8
|
+
1. **ノートの関係の観測** — 一覧・リンク・被リンク・切れたリンク・孤立したノート。
|
|
9
|
+
2. **ブロックの木** — 見出し・段落・リスト・コード・表などを、閉じた語彙の木に落とします(本文は出しません)。
|
|
10
|
+
3. **ドキュメント ⇄ アウトラインの変換** — 構造木を介した純粋な変換。元のファイルは変えず、新しいファイルに書き出します。
|
|
11
|
+
4. **リンク関係の図** — ノートのつながりを、図(`svg`)や、既存の描画ツール向けの文章(`dot`・`mermaid`)、機械向けの形(`json`)で出します。
|
|
12
|
+
5. **置き場所と並び順の計画** — どのノートをどこに置けるか、各フォルダのノートがどんな順に並ぶかを、動かす前に出します。
|
|
13
|
+
|
|
14
|
+
標準ライブラリだけで動きます(実行時の依存は 1 つもありません)。
|
|
15
|
+
Python 3.10 以上。オフラインで動き、利用の記録を送りません。
|
|
16
|
+
|
|
17
|
+
## 何ができるか
|
|
18
|
+
|
|
19
|
+
```console
|
|
20
|
+
$ sieve-notes index ./vault
|
|
21
|
+
notes 3
|
|
22
|
+
links wikilink=4 embed=1 markdown_link=1 block_ref=1
|
|
23
|
+
link_states resolved=5 broken=1 ambiguous=0 fragment_missing=1
|
|
24
|
+
orphan_notes 1
|
|
25
|
+
excluded_dirs 2
|
|
26
|
+
skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
|
|
27
|
+
math_blocks 2
|
|
28
|
+
math_inline 3
|
|
29
|
+
note a.md resolved=2 broken=1 ambiguous=0 fragment_missing=0 backlinks=1 collapsed=1 comments=2 math_blocks=1 math_inline=2
|
|
30
|
+
broken a.md:7 wikilink broken ghost
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`index` は vault 全体の関係を観測します。機械で読む形は
|
|
34
|
+
`--format json`(`notes_version: 1` の契約)です。
|
|
35
|
+
|
|
36
|
+
同梱の例の vault(`examples/vault_wikilink`)の graph が描いた図です:
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
```console
|
|
41
|
+
$ sieve-notes graph ./vault --view links --format json
|
|
42
|
+
{
|
|
43
|
+
"command": "graph",
|
|
44
|
+
"edges": [
|
|
45
|
+
{
|
|
46
|
+
"from": "n1",
|
|
47
|
+
"links": 1,
|
|
48
|
+
"to": "n3"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"from": "n2",
|
|
52
|
+
"links": 1,
|
|
53
|
+
"to": "n3"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"from": "n3",
|
|
57
|
+
"links": 1,
|
|
58
|
+
"to": "n1"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"from": "n3",
|
|
62
|
+
"links": 3,
|
|
63
|
+
"to": "n2"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"exit_code": 0,
|
|
67
|
+
"nodes": [
|
|
68
|
+
{
|
|
69
|
+
"id": "n1",
|
|
70
|
+
"kind": "note",
|
|
71
|
+
"path": "daily/2026-11-28.md"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "n2",
|
|
75
|
+
"kind": "note",
|
|
76
|
+
"path": "ideas/plan.md"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "n3",
|
|
80
|
+
"kind": "note",
|
|
81
|
+
"path": "index.md"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"notes_version": 1,
|
|
85
|
+
"totals": {
|
|
86
|
+
"edges": 4,
|
|
87
|
+
"links_outside_scope": 0,
|
|
88
|
+
"nodes": 3
|
|
89
|
+
},
|
|
90
|
+
"view": "links"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`graph` は同じ関係を図や文章で出します。節点は決まった並び順の
|
|
95
|
+
`n1`・`n2`…で、形式をまたいで同じなので、図と JSON を突き合わせられます。
|
|
96
|
+
`--no-names` はノート名を見せずに構造だけを共有し、`--max-nodes`
|
|
97
|
+
(既定 200)は大きな図を描かずに誤りで止まります。
|
|
98
|
+
|
|
99
|
+
```console
|
|
100
|
+
$ sieve-notes plan ./vault --rules rules.txt
|
|
101
|
+
notes 3
|
|
102
|
+
move 2
|
|
103
|
+
stay 0
|
|
104
|
+
unmatched 1
|
|
105
|
+
blocked_collision 0
|
|
106
|
+
links_before resolved=8 broken=1 ambiguous=0 fragment_missing=0
|
|
107
|
+
links_after resolved=4 broken=5 ambiguous=0 fragment_missing=0
|
|
108
|
+
transitions resolved→broken=4
|
|
109
|
+
move daily/2026-11-28.md -> journal rule=1
|
|
110
|
+
move ideas/plan.md -> projects rule=2
|
|
111
|
+
changed index.md:3 wikilink from=daily/2026-11-28.md to=-
|
|
112
|
+
changed index.md:4 wikilink from=ideas/plan.md to=-
|
|
113
|
+
changed index.md:5 wikilink from=ideas/plan.md to=-
|
|
114
|
+
changed index.md:8 markdown_link from=ideas/plan.md to=-
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`rules.txt` の中身:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
path:daily/* => journal
|
|
121
|
+
name:plan => projects
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`plan` は計画を出すだけで、ファイルを動かしませんし名前も変えませんし書き込みもしません。
|
|
125
|
+
報告は、計画どおりに動かしたならリンクがどう変わるかを示します —
|
|
126
|
+
この例では `index.md` のパス付きのリンク 4 件が切れ、動く側のノートの
|
|
127
|
+
名前だけの `[[index]]` は切れません。`unmatched` は、どの規則にも
|
|
128
|
+
合わなかったノートの件数です。
|
|
129
|
+
|
|
130
|
+
```console
|
|
131
|
+
$ sieve-notes blocks ./vault/notes/plan.md
|
|
132
|
+
dialect document
|
|
133
|
+
block frontmatter depth=0 lines=1-3
|
|
134
|
+
block heading depth=0 lines=4-4
|
|
135
|
+
block paragraph depth=1 lines=6-7
|
|
136
|
+
block math depth=1 lines=9-12
|
|
137
|
+
block list_item depth=2 lines=14-14
|
|
138
|
+
...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`blocks` は 1 つのノートの構造を、種類・深さ・行の範囲で出します。
|
|
142
|
+
本文は出しません。
|
|
143
|
+
|
|
144
|
+
```console
|
|
145
|
+
$ sieve-notes convert ./vault/notes/plan.md --to outline -o plan-outline.md
|
|
146
|
+
kept_as_text_fold_state 0
|
|
147
|
+
kept_as_text_block_id 0
|
|
148
|
+
kept_as_text_properties 0
|
|
149
|
+
kept_as_text_frontmatter 0
|
|
150
|
+
kept_as_text_unsupported 0
|
|
151
|
+
list_became_paragraphs 0
|
|
152
|
+
ordered_list_became_bullets 0
|
|
153
|
+
lists_merged 0
|
|
154
|
+
output plan-outline.md
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`convert` はドキュメント形式とアウトライナー形式を相互に変換します。
|
|
158
|
+
出力先が既に存在するなら上書きしません(終了符号 2)。
|
|
159
|
+
|
|
160
|
+
## 使い方の例
|
|
161
|
+
|
|
162
|
+
- `sieve-notes index PATH` — vault の関係の観測。
|
|
163
|
+
`--strict` は切れたリンク・あいまいな解決・見つからない断片があったとき
|
|
164
|
+
終了符号 1 で終わります。`--no-names` はリンク先の名前を出さない形にします。
|
|
165
|
+
- `sieve-notes blocks FILE` — 1 つのノートのブロックの木。
|
|
166
|
+
`--dialect auto|document|outline` で方言を指定できます。
|
|
167
|
+
- `sieve-notes convert FILE --to outline|document -o OUT` — 変換。
|
|
168
|
+
`--indent tab|2|4` で項目の字下げの文字を選びます(既定は空白 2 個)。
|
|
169
|
+
- `sieve-notes graph PATH` — リンク関係の図
|
|
170
|
+
(`--view links|folders|tree`、`--format svg|dot|mermaid|json`、
|
|
171
|
+
`--scope DIR`、`--depth N`、`--max-nodes N`、`--no-names`、`-o FILE`)。
|
|
172
|
+
- `sieve-notes plan PATH` — 置き場所と並び順の計画
|
|
173
|
+
(`--rules FILE`、`--order name|links|backlinks|heading|size`、
|
|
174
|
+
`--order-file FILE`、`--reverse`、`--strict`)。
|
|
175
|
+
- `sieve-notes --self-check` — 同梱の小さな試料で、観測と変換が
|
|
176
|
+
期待どおりか確かめます(終了符号 0 / 1 / 2)。
|
|
177
|
+
|
|
178
|
+
Python からは `index_vault` / `block_tree` / `convert_text` /
|
|
179
|
+
`graph_vault` / `plan_vault` の 5 つの関数が同じ形
|
|
180
|
+
(`notes_version: 1`)を返します。
|
|
181
|
+
|
|
182
|
+
## 対応する書式
|
|
183
|
+
|
|
184
|
+
- 内部リンク(別名・見出し・ブロック ID・埋め込み)
|
|
185
|
+
- Markdown 形式の相対パスのリンク
|
|
186
|
+
- ブロックの参照(`((id))` の形)
|
|
187
|
+
- コメント(`%%…%%` と HTML コメント)
|
|
188
|
+
- 数式(インライン `$…$`、表示 `$$…$$`)— 範囲と件数を観測します(本文は出しません)
|
|
189
|
+
- プロパティ(frontmatter と `key:: value` の行)
|
|
190
|
+
- コールアウト(折りたたみ `> [!x]-` を含む)
|
|
191
|
+
- ファイルの置き場所とフォルダの構成(既定の除外:
|
|
192
|
+
`.obsidian/`・`.trash/`・`logseq/`・`.git/`)
|
|
193
|
+
- 字下げの文字(タブまたは空白 2 個を 1 段として扱います)
|
|
194
|
+
|
|
195
|
+
書式ごとの出所と、この版の扱いは docs の下にあります:
|
|
196
|
+
`docs/formats.md`(対応する書式と公式の文書の出所)・
|
|
197
|
+
`docs/vocabulary.md`(閉じた語彙と出力の契約)・
|
|
198
|
+
`docs/resolution.md`(リンクの解決の規則)・
|
|
199
|
+
`docs/convert.md`(変換の規則と性質)・
|
|
200
|
+
`docs/graph.md`(リンク関係の図)・
|
|
201
|
+
`docs/plan.md`(置き場所と並び順の計画)。
|
|
202
|
+
|
|
203
|
+
## ライセンス
|
|
204
|
+
|
|
205
|
+
MIT License。[LICENSE](https://github.com/neguseatama/sieve-notes/blob/main/LICENSE) を参照してください。
|
|
206
|
+
|
|
207
|
+
Copyright (c) 2026 Kai IWASAKI
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Sieve Notes v0.3.0
|
|
2
|
+
|
|
3
|
+
English | [日本語](https://github.com/neguseatama/sieve-notes/blob/main/README.ja.md)
|
|
4
|
+
|
|
5
|
+
A command-line tool that reads a folder of Markdown notes (the vault of a
|
|
6
|
+
note-taking app, called a vault below) and deterministically produces:
|
|
7
|
+
|
|
8
|
+
1. **Note relation observation** — the list of notes, links, backlinks,
|
|
9
|
+
broken links, and orphan notes.
|
|
10
|
+
2. **The block tree** — headings, paragraphs, lists, code, tables and more,
|
|
11
|
+
lowered into one closed vocabulary (no note bodies are emitted).
|
|
12
|
+
3. **Document ⇄ outline conversion** — a pure conversion through the tree.
|
|
13
|
+
The original file is never modified; the result goes to a new file.
|
|
14
|
+
4. **The link graph** — the note relations as a picture (`svg`) or as text
|
|
15
|
+
for existing drawing tools (`dot`, `mermaid`) or for machines (`json`).
|
|
16
|
+
5. **Placement and order plans** — where each note could be placed, and in
|
|
17
|
+
which order the notes of a folder would stand, before anything is moved.
|
|
18
|
+
|
|
19
|
+
It runs on the standard library alone (no runtime dependencies).
|
|
20
|
+
Python 3.10 or later. It works offline and sends no telemetry.
|
|
21
|
+
|
|
22
|
+
## What it does
|
|
23
|
+
|
|
24
|
+
```console
|
|
25
|
+
$ sieve-notes index ./vault
|
|
26
|
+
notes 3
|
|
27
|
+
links wikilink=4 embed=1 markdown_link=1 block_ref=1
|
|
28
|
+
link_states resolved=5 broken=1 ambiguous=0 fragment_missing=1
|
|
29
|
+
orphan_notes 1
|
|
30
|
+
excluded_dirs 2
|
|
31
|
+
skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
|
|
32
|
+
math_blocks 2
|
|
33
|
+
math_inline 3
|
|
34
|
+
note a.md resolved=2 broken=1 ambiguous=0 fragment_missing=0 backlinks=1 collapsed=1 comments=2 math_blocks=1 math_inline=2
|
|
35
|
+
broken a.md:7 wikilink broken ghost
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`index` observes the relations of the whole vault. For machines use
|
|
39
|
+
`--format json` (the `notes_version: 1` contract).
|
|
40
|
+
|
|
41
|
+
The graph of the bundled example vault (`examples/vault_wikilink`), drawn by
|
|
42
|
+
`graph` itself:
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
```console
|
|
47
|
+
$ sieve-notes graph ./vault --view links --format json
|
|
48
|
+
{
|
|
49
|
+
"command": "graph",
|
|
50
|
+
"edges": [
|
|
51
|
+
{
|
|
52
|
+
"from": "n1",
|
|
53
|
+
"links": 1,
|
|
54
|
+
"to": "n3"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"from": "n2",
|
|
58
|
+
"links": 1,
|
|
59
|
+
"to": "n3"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"from": "n3",
|
|
63
|
+
"links": 1,
|
|
64
|
+
"to": "n1"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"from": "n3",
|
|
68
|
+
"links": 3,
|
|
69
|
+
"to": "n2"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"exit_code": 0,
|
|
73
|
+
"nodes": [
|
|
74
|
+
{
|
|
75
|
+
"id": "n1",
|
|
76
|
+
"kind": "note",
|
|
77
|
+
"path": "daily/2026-11-28.md"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "n2",
|
|
81
|
+
"kind": "note",
|
|
82
|
+
"path": "ideas/plan.md"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "n3",
|
|
86
|
+
"kind": "note",
|
|
87
|
+
"path": "index.md"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"notes_version": 1,
|
|
91
|
+
"totals": {
|
|
92
|
+
"edges": 4,
|
|
93
|
+
"links_outside_scope": 0,
|
|
94
|
+
"nodes": 3
|
|
95
|
+
},
|
|
96
|
+
"view": "links"
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`graph` shows the same relations as a picture or text. The nodes are `n1`,
|
|
101
|
+
`n2`, ... in a fixed order, the same in every format, so the picture and the
|
|
102
|
+
JSON can be joined. `--no-names` shares the structure without the note
|
|
103
|
+
names, and `--max-nodes` (default 200) stops with an error instead of
|
|
104
|
+
drawing a huge graph.
|
|
105
|
+
|
|
106
|
+
```console
|
|
107
|
+
$ sieve-notes plan ./vault --rules rules.txt
|
|
108
|
+
notes 3
|
|
109
|
+
move 2
|
|
110
|
+
stay 0
|
|
111
|
+
unmatched 1
|
|
112
|
+
blocked_collision 0
|
|
113
|
+
links_before resolved=8 broken=1 ambiguous=0 fragment_missing=0
|
|
114
|
+
links_after resolved=4 broken=5 ambiguous=0 fragment_missing=0
|
|
115
|
+
transitions resolved→broken=4
|
|
116
|
+
move daily/2026-11-28.md -> journal rule=1
|
|
117
|
+
move ideas/plan.md -> projects rule=2
|
|
118
|
+
changed index.md:3 wikilink from=daily/2026-11-28.md to=-
|
|
119
|
+
changed index.md:4 wikilink from=ideas/plan.md to=-
|
|
120
|
+
changed index.md:5 wikilink from=ideas/plan.md to=-
|
|
121
|
+
changed index.md:8 markdown_link from=ideas/plan.md to=-
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
with `rules.txt`:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
path:daily/* => journal
|
|
128
|
+
name:plan => projects
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`plan` only plans: nothing is moved, renamed or written. The report tells
|
|
132
|
+
you what would happen to the links if the moves were carried out — here the
|
|
133
|
+
four path-form links of `index.md` would break, while the name-only
|
|
134
|
+
`[[index]]` links of the moved notes keep working. `unmatched` counts the
|
|
135
|
+
notes that no rule matched.
|
|
136
|
+
|
|
137
|
+
```console
|
|
138
|
+
$ sieve-notes blocks ./vault/notes/plan.md
|
|
139
|
+
dialect document
|
|
140
|
+
block frontmatter depth=0 lines=1-3
|
|
141
|
+
block heading depth=0 lines=4-4
|
|
142
|
+
block paragraph depth=1 lines=6-7
|
|
143
|
+
block math depth=1 lines=9-12
|
|
144
|
+
block list_item depth=2 lines=14-14
|
|
145
|
+
...
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`blocks` prints the structure of one note as type, depth and line range.
|
|
149
|
+
Note bodies are never emitted.
|
|
150
|
+
|
|
151
|
+
```console
|
|
152
|
+
$ sieve-notes convert ./vault/notes/plan.md --to outline -o plan-outline.md
|
|
153
|
+
kept_as_text_fold_state 0
|
|
154
|
+
kept_as_text_block_id 0
|
|
155
|
+
kept_as_text_properties 0
|
|
156
|
+
kept_as_text_frontmatter 0
|
|
157
|
+
kept_as_text_unsupported 0
|
|
158
|
+
list_became_paragraphs 0
|
|
159
|
+
ordered_list_became_bullets 0
|
|
160
|
+
lists_merged 0
|
|
161
|
+
output plan-outline.md
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`convert` converts between the document form and the outline form.
|
|
165
|
+
It never overwrites an existing output file (exit code 2).
|
|
166
|
+
|
|
167
|
+
## Examples
|
|
168
|
+
|
|
169
|
+
- `sieve-notes index PATH` — observe the vault relations.
|
|
170
|
+
`--strict` exits 1 when a broken link, an ambiguous resolution or a
|
|
171
|
+
missing fragment is present. `--no-names` omits the link target names.
|
|
172
|
+
- `sieve-notes blocks FILE` — the block tree of one note.
|
|
173
|
+
`--dialect auto|document|outline` selects the dialect.
|
|
174
|
+
- `sieve-notes convert FILE --to outline|document -o OUT` — conversion.
|
|
175
|
+
`--indent tab|2|4` selects the item indentation (the default is two spaces).
|
|
176
|
+
- `sieve-notes graph PATH` — the link graph
|
|
177
|
+
(`--view links|folders|tree`, `--format svg|dot|mermaid|json`,
|
|
178
|
+
`--scope DIR`, `--depth N`, `--max-nodes N`, `--no-names`, `-o FILE`).
|
|
179
|
+
- `sieve-notes plan PATH` — a placement or order plan
|
|
180
|
+
(`--rules FILE`, `--order name|links|backlinks|heading|size`,
|
|
181
|
+
`--order-file FILE`, `--reverse`, `--strict`).
|
|
182
|
+
- `sieve-notes --self-check` — verifies the bundled small sample
|
|
183
|
+
(exit codes 0 / 1 / 2).
|
|
184
|
+
|
|
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`).
|
|
188
|
+
|
|
189
|
+
## Supported formats
|
|
190
|
+
|
|
191
|
+
- Internal links (aliases, headings, block IDs, embeds)
|
|
192
|
+
- Markdown-form relative-path links
|
|
193
|
+
- Block references (the `((id))` form)
|
|
194
|
+
- Comments (`%%…%%` and HTML comments)
|
|
195
|
+
- Math (inline `$…$`, display `$$…$$`) — observed as ranges and counts; math bodies are never emitted
|
|
196
|
+
- Properties (frontmatter and `key:: value` lines)
|
|
197
|
+
- Callouts (including folded `> [!x]-`)
|
|
198
|
+
- File placement and folder layout (default exclusions:
|
|
199
|
+
`.obsidian/`, `.trash/`, `logseq/`, `.git/`)
|
|
200
|
+
- Indentation characters (one tab or two spaces per level)
|
|
201
|
+
|
|
202
|
+
The sources per format and the rules of this version live in docs:
|
|
203
|
+
`docs/formats.md` (supported formats and their official sources),
|
|
204
|
+
`docs/vocabulary.md` (the closed vocabulary and the output contract),
|
|
205
|
+
`docs/resolution.md` (the link resolution rules),
|
|
206
|
+
`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).
|
|
209
|
+
|
|
210
|
+
## License
|
|
211
|
+
|
|
212
|
+
MIT License. See [LICENSE](https://github.com/neguseatama/sieve-notes/blob/main/LICENSE).
|
|
213
|
+
|
|
214
|
+
Copyright (c) 2026 Kai IWASAKI
|
|
@@ -21,8 +21,8 @@ output file is never overwritten (exit code 2, `output_exists`).
|
|
|
21
21
|
continuation lines under the item).
|
|
22
22
|
- A list item becomes a child item of the preceding paragraph (or heading).
|
|
23
23
|
Nesting is kept as item nesting.
|
|
24
|
-
- Code, tables, quotes and HTML are placed as they are inside one item
|
|
25
|
-
(continuation lines are indented).
|
|
24
|
+
- Code, math, tables, quotes and HTML are placed as they are inside one item
|
|
25
|
+
(continuation lines are indented; blank lines inside math are kept).
|
|
26
26
|
- An ordered item (`1.` / `1)`) loses its number, becomes a plain item, and
|
|
27
27
|
is counted in `ordered_list_became_bullets`.
|
|
28
28
|
- A list directly under a heading (or the root) becomes a paragraph when
|
|
@@ -38,8 +38,10 @@ output file is never overwritten (exit code 2, `output_exists`).
|
|
|
38
38
|
- An item with children becomes a paragraph followed by a list of the children.
|
|
39
39
|
- An item without children becomes a paragraph.
|
|
40
40
|
- Deep nesting becomes nested lists (two-space indentation, canonical form).
|
|
41
|
-
- When the content of an item starts with a fence, quote, table,
|
|
42
|
-
HTML marker, it is restored as a block of literal text.
|
|
41
|
+
- When the content of an item starts with a fence, `$$`, quote, table,
|
|
42
|
+
comment or HTML marker, it is restored as a block of literal text. A math
|
|
43
|
+
range inside an item is restored as its own block of literal lines, so
|
|
44
|
+
that the round trip stays a fixed point.
|
|
43
45
|
- Continuation lines are restored by stripping the item's depth + 1 levels
|
|
44
46
|
of indentation.
|
|
45
47
|
- Raw root lines (kept lines) are preserved in place, with consecutive ones
|
|
@@ -70,8 +72,8 @@ placed inside an item in the same form as a quote (the text does not change).
|
|
|
70
72
|
|
|
71
73
|
- **P1**: A canonical document (LF line endings, ATX headings, `-` lists, one
|
|
72
74
|
blank line between blocks) made only of headings, paragraphs, nested lists
|
|
73
|
-
with an introductory paragraph, code, tables and quotes is
|
|
74
|
-
after document → outline → document.
|
|
75
|
+
with an introductory paragraph, code, math, tables and quotes is
|
|
76
|
+
byte-identical after document → outline → document.
|
|
75
77
|
- **P2**: For any input, every round trip after the first matches the
|
|
76
78
|
output of the first (a fixed point).
|
|
77
79
|
- A structure whose shape changes on a round trip is never changed silently;
|