sieve-notes 0.1.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 (34) hide show
  1. sieve_notes-0.1.0/CHANGELOG.md +8 -0
  2. sieve_notes-0.1.0/LICENSE +21 -0
  3. sieve_notes-0.1.0/MANIFEST.in +10 -0
  4. sieve_notes-0.1.0/PKG-INFO +122 -0
  5. sieve_notes-0.1.0/README.ja.md +97 -0
  6. sieve_notes-0.1.0/README.md +100 -0
  7. sieve_notes-0.1.0/conftest.py +13 -0
  8. sieve_notes-0.1.0/docs/convert.md +91 -0
  9. sieve_notes-0.1.0/docs/formats.md +41 -0
  10. sieve_notes-0.1.0/docs/resolution.md +69 -0
  11. sieve_notes-0.1.0/docs/vocabulary.md +93 -0
  12. sieve_notes-0.1.0/examples/README.md +23 -0
  13. sieve_notes-0.1.0/examples/vault_mixed/meeting.md +4 -0
  14. sieve_notes-0.1.0/examples/vault_mixed/overview.md +6 -0
  15. sieve_notes-0.1.0/examples/vault_outline/meeting.md +11 -0
  16. sieve_notes-0.1.0/examples/vault_outline/reading.md +7 -0
  17. sieve_notes-0.1.0/examples/vault_wikilink/daily/2026-11-28.md +12 -0
  18. sieve_notes-0.1.0/examples/vault_wikilink/ideas/plan.md +8 -0
  19. sieve_notes-0.1.0/examples/vault_wikilink/index.md +18 -0
  20. sieve_notes-0.1.0/pyproject.toml +35 -0
  21. sieve_notes-0.1.0/setup.cfg +4 -0
  22. sieve_notes-0.1.0/sieve_notes.egg-info/PKG-INFO +122 -0
  23. sieve_notes-0.1.0/sieve_notes.egg-info/SOURCES.txt +32 -0
  24. sieve_notes-0.1.0/sieve_notes.egg-info/dependency_links.txt +1 -0
  25. sieve_notes-0.1.0/sieve_notes.egg-info/entry_points.txt +2 -0
  26. sieve_notes-0.1.0/sieve_notes.egg-info/top_level.txt +1 -0
  27. sieve_notes-0.1.0/sieve_notes.py +1797 -0
  28. sieve_notes-0.1.0/tests/public_text_baseline.json +1 -0
  29. sieve_notes-0.1.0/tests/test_notes_nt.py +1013 -0
  30. sieve_notes-0.1.0/tests/test_public_text.py +408 -0
  31. sieve_notes-0.1.0/tools/check_public_text.py +297 -0
  32. sieve_notes-0.1.0/tools/check_release_assets.py +68 -0
  33. sieve_notes-0.1.0/tools/check_release_version.py +64 -0
  34. sieve_notes-0.1.0/tools/extract_changelog.py +56 -0
@@ -0,0 +1,8 @@
1
+ ## [0.1.0] - 2026-11-29
2
+
3
+ ### Added
4
+
5
+ - `index` observes the relations of a Markdown vault deterministically: notes, links, backlinks, broken links and orphan notes.
6
+ - `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.
7
+ - `convert` converts between the document form and the outliner form. It writes a new file and never modifies the original.
8
+ - `--self-check` verifies observation and conversion against a small bundled sample.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kai IWASAKI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ include LICENSE
2
+ include CHANGELOG.md
3
+ include conftest.py
4
+ include README.md
5
+ include README.ja.md
6
+ recursive-include docs *.md
7
+ recursive-include examples *.py *.md
8
+ recursive-include tools *.py
9
+ recursive-include tests *.py *.json
10
+ global-exclude __pycache__ *.py[cod]
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.4
2
+ Name: sieve-notes
3
+ Version: 0.1.0
4
+ Summary: Deterministic observation and conversion for Markdown note vaults: note relations, block trees, and document-outline round trips
5
+ Author: Kai IWASAKI
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/neguseatama/sieve-notes
8
+ Project-URL: Repository, https://github.com/neguseatama/sieve-notes.git
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: End Users/Desktop
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
22
+
23
+ # Sieve Notes v0.1.0
24
+
25
+ A command-line tool that reads a folder of Markdown notes (the vault of a
26
+ note-taking app, called a vault below) and deterministically produces:
27
+
28
+ 1. **Note relation observation** — the list of notes, links, backlinks,
29
+ broken links, and orphan notes.
30
+ 2. **The block tree** — headings, paragraphs, lists, code, tables and more,
31
+ lowered into one closed vocabulary (no note bodies are emitted).
32
+ 3. **Document ⇄ outline conversion** — a pure conversion through the tree.
33
+ The original file is never modified; the result goes to a new file.
34
+
35
+ It runs on the standard library alone (no runtime dependencies).
36
+ Python 3.10 or later. It works offline and sends no telemetry.
37
+
38
+ ## What it does
39
+
40
+ ```console
41
+ $ sieve-notes index ./vault
42
+ notes 3
43
+ links wikilink=4 embed=1 markdown_link=1 block_ref=1
44
+ link_states resolved=5 broken=1 ambiguous=0 fragment_missing=1
45
+ orphan_notes 1
46
+ excluded_dirs 2
47
+ skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
48
+ note a.md resolved=2 broken=1 ambiguous=0 fragment_missing=0 backlinks=1 collapsed=1 comments=2
49
+ broken a.md:7 wikilink broken ghost
50
+ ```
51
+
52
+ `index` observes the relations of the whole vault. For machines use
53
+ `--format json` (the `notes_version: 1` contract).
54
+
55
+ ```console
56
+ $ sieve-notes blocks ./vault/notes/plan.md
57
+ dialect document
58
+ block frontmatter depth=0 lines=1-3
59
+ block heading depth=0 lines=4-4
60
+ block paragraph depth=1 lines=6-7
61
+ block list_item depth=2 lines=9-9
62
+ ...
63
+ ```
64
+
65
+ `blocks` prints the structure of one note as type, depth and line range.
66
+ Note bodies are never emitted.
67
+
68
+ ```console
69
+ $ sieve-notes convert ./vault/notes/plan.md --to outline -o plan-outline.md
70
+ kept_as_text_fold_state 0
71
+ kept_as_text_block_id 0
72
+ kept_as_text_properties 0
73
+ kept_as_text_frontmatter 0
74
+ kept_as_text_unsupported 0
75
+ list_became_paragraphs 0
76
+ ordered_list_became_bullets 0
77
+ lists_merged 0
78
+ output plan-outline.md
79
+ ```
80
+
81
+ `convert` converts between the document form and the outline form.
82
+ It never overwrites an existing output file (exit code 2).
83
+
84
+ ## Examples
85
+
86
+ - `sieve-notes index PATH` — observe the vault relations.
87
+ `--strict` exits 1 when a broken link, an ambiguous resolution or a
88
+ missing fragment is present. `--no-names` omits the link target names.
89
+ - `sieve-notes blocks FILE` — the block tree of one note.
90
+ `--dialect auto|document|outline` selects the dialect.
91
+ - `sieve-notes convert FILE --to outline|document -o OUT` — conversion.
92
+ `--indent tab|2|4` selects the item indentation (the default is two spaces).
93
+ - `sieve-notes --self-check` — verifies the bundled small sample
94
+ (exit codes 0 / 1 / 2).
95
+
96
+ From Python, the three functions `index_vault` / `block_tree` /
97
+ `convert_text` return the same shape (`notes_version: 1`).
98
+
99
+ ## Supported formats
100
+
101
+ - Internal links (aliases, headings, block IDs, embeds)
102
+ - Markdown-form relative-path links
103
+ - Block references (the `((id))` form)
104
+ - Comments (`%%…%%` and HTML comments)
105
+ - Properties (frontmatter and `key:: value` lines)
106
+ - Callouts (including folded `> [!x]-`)
107
+ - Tags
108
+ - File placement and folder layout (default exclusions:
109
+ `.obsidian/`, `.trash/`, `logseq/`, `.git/`)
110
+ - Indentation characters (one tab or two spaces per level)
111
+
112
+ The sources per format and the rules of this version live in docs:
113
+ `docs/formats.md` (supported formats and their official sources),
114
+ `docs/vocabulary.md` (the closed vocabulary and the output contract),
115
+ `docs/resolution.md` (the link resolution rules) and
116
+ `docs/convert.md` (the conversion rules and properties).
117
+
118
+ ## License
119
+
120
+ MIT License. See [LICENSE](https://github.com/neguseatama/sieve-notes/blob/main/LICENSE).
121
+
122
+ Copyright (c) 2026 Kai IWASAKI
@@ -0,0 +1,97 @@
1
+ # Sieve Notes v0.1.0
2
+
3
+ Markdown のノートを集めたフォルダ(ノート用アプリの保管庫。以下 vault)を
4
+ 読み、次の 3 つを、決定論的に出すコマンドラインの道具です。
5
+
6
+ 1. **ノートの関係の観測** — 一覧・リンク・被リンク・切れたリンク・孤立したノート。
7
+ 2. **ブロックの木** — 見出し・段落・リスト・コード・表などを、閉じた語彙の木に落とします(本文は出しません)。
8
+ 3. **ドキュメント ⇄ アウトラインの変換** — 構造木を介した純粋な変換。元のファイルは変えず、新しいファイルに書き出します。
9
+
10
+ 標準ライブラリだけで動きます(実行時の依存は 1 つもありません)。
11
+ Python 3.10 以上。オフラインで動き、利用の記録を送りません。
12
+
13
+ ## 何ができるか
14
+
15
+ ```console
16
+ $ sieve-notes index ./vault
17
+ notes 3
18
+ links wikilink=4 embed=1 markdown_link=1 block_ref=1
19
+ link_states resolved=5 broken=1 ambiguous=0 fragment_missing=1
20
+ orphan_notes 1
21
+ excluded_dirs 2
22
+ skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
23
+ note a.md resolved=2 broken=1 ambiguous=0 fragment_missing=0 backlinks=1 collapsed=1 comments=2
24
+ broken a.md:7 wikilink broken ghost
25
+ ```
26
+
27
+ `index` は vault 全体の関係を観測します。機械で読む形は
28
+ `--format json`(`notes_version: 1` の契約)です。
29
+
30
+ ```console
31
+ $ sieve-notes blocks ./vault/notes/plan.md
32
+ dialect document
33
+ block frontmatter depth=0 lines=1-3
34
+ block heading depth=0 lines=4-4
35
+ block paragraph depth=1 lines=6-7
36
+ block list_item depth=2 lines=9-9
37
+ ...
38
+ ```
39
+
40
+ `blocks` は 1 つのノートの構造を、種類・深さ・行の範囲で出します。
41
+ 本文は出しません。
42
+
43
+ ```console
44
+ $ sieve-notes convert ./vault/notes/plan.md --to outline -o plan-outline.md
45
+ kept_as_text_fold_state 0
46
+ kept_as_text_block_id 0
47
+ kept_as_text_properties 0
48
+ kept_as_text_frontmatter 0
49
+ kept_as_text_unsupported 0
50
+ list_became_paragraphs 0
51
+ ordered_list_became_bullets 0
52
+ lists_merged 0
53
+ output plan-outline.md
54
+ ```
55
+
56
+ `convert` はドキュメント形式とアウトライナー形式を相互に変換します。
57
+ 出力先が既に存在するなら上書きしません(終了符号 2)。
58
+
59
+ ## 使い方の例
60
+
61
+ - `sieve-notes index PATH` — vault の関係の観測。
62
+ `--strict` は切れたリンク・あいまいな解決・見つからない断片があったとき
63
+ 終了符号 1 で終わります。`--no-names` はリンク先の名前を出さない形にします。
64
+ - `sieve-notes blocks FILE` — 1 つのノートのブロックの木。
65
+ `--dialect auto|document|outline` で方言を指定できます。
66
+ - `sieve-notes convert FILE --to outline|document -o OUT` — 変換。
67
+ `--indent tab|2|4` で項目の字下げの文字を選びます(既定は空白 2 個)。
68
+ - `sieve-notes --self-check` — 同梱の小さな試料で、観測と変換が
69
+ 期待どおりか確かめます(終了符号 0 / 1 / 2)。
70
+
71
+ Python からは `index_vault` / `block_tree` / `convert_text` の
72
+ 3 つの関数が同じ形(`notes_version: 1`)を返します。
73
+
74
+ ## 対応する書式
75
+
76
+ - 内部リンク(別名・見出し・ブロック ID・埋め込み)
77
+ - Markdown 形式の相対パスのリンク
78
+ - ブロックの参照(`((id))` の形)
79
+ - コメント(`%%…%%` と HTML コメント)
80
+ - プロパティ(frontmatter と `key:: value` の行)
81
+ - コールアウト(折りたたみ `> [!x]-` を含む)
82
+ - タグ
83
+ - ファイルの置き場所とフォルダの構成(既定の除外:
84
+ `.obsidian/`・`.trash/`・`logseq/`・`.git/`)
85
+ - 字下げの文字(タブまたは空白 2 個を 1 段として扱います)
86
+
87
+ 書式ごとの出所と、この版の扱いは docs の下にあります:
88
+ `docs/formats.md`(対応する書式と公式の文書の出所)・
89
+ `docs/vocabulary.md`(閉じた語彙と出力の契約)・
90
+ `docs/resolution.md`(リンクの解決の規則)・
91
+ `docs/convert.md`(変換の規則と性質)。
92
+
93
+ ## ライセンス
94
+
95
+ MIT License。[LICENSE](https://github.com/neguseatama/sieve-notes/blob/main/LICENSE) を参照してください。
96
+
97
+ Copyright (c) 2026 Kai IWASAKI
@@ -0,0 +1,100 @@
1
+ # Sieve Notes v0.1.0
2
+
3
+ A command-line tool that reads a folder of Markdown notes (the vault of a
4
+ note-taking app, called a vault below) and deterministically produces:
5
+
6
+ 1. **Note relation observation** — the list of notes, links, backlinks,
7
+ broken links, and orphan notes.
8
+ 2. **The block tree** — headings, paragraphs, lists, code, tables and more,
9
+ lowered into one closed vocabulary (no note bodies are emitted).
10
+ 3. **Document ⇄ outline conversion** — a pure conversion through the tree.
11
+ The original file is never modified; the result goes to a new file.
12
+
13
+ It runs on the standard library alone (no runtime dependencies).
14
+ Python 3.10 or later. It works offline and sends no telemetry.
15
+
16
+ ## What it does
17
+
18
+ ```console
19
+ $ sieve-notes index ./vault
20
+ notes 3
21
+ links wikilink=4 embed=1 markdown_link=1 block_ref=1
22
+ link_states resolved=5 broken=1 ambiguous=0 fragment_missing=1
23
+ orphan_notes 1
24
+ excluded_dirs 2
25
+ skipped symlink_skipped=0 too_large=0 unreadable=0 unsupported_encoding=0 file_limit=0
26
+ note a.md resolved=2 broken=1 ambiguous=0 fragment_missing=0 backlinks=1 collapsed=1 comments=2
27
+ broken a.md:7 wikilink broken ghost
28
+ ```
29
+
30
+ `index` observes the relations of the whole vault. For machines use
31
+ `--format json` (the `notes_version: 1` contract).
32
+
33
+ ```console
34
+ $ sieve-notes blocks ./vault/notes/plan.md
35
+ dialect document
36
+ block frontmatter depth=0 lines=1-3
37
+ block heading depth=0 lines=4-4
38
+ block paragraph depth=1 lines=6-7
39
+ block list_item depth=2 lines=9-9
40
+ ...
41
+ ```
42
+
43
+ `blocks` prints the structure of one note as type, depth and line range.
44
+ Note bodies are never emitted.
45
+
46
+ ```console
47
+ $ sieve-notes convert ./vault/notes/plan.md --to outline -o plan-outline.md
48
+ kept_as_text_fold_state 0
49
+ kept_as_text_block_id 0
50
+ kept_as_text_properties 0
51
+ kept_as_text_frontmatter 0
52
+ kept_as_text_unsupported 0
53
+ list_became_paragraphs 0
54
+ ordered_list_became_bullets 0
55
+ lists_merged 0
56
+ output plan-outline.md
57
+ ```
58
+
59
+ `convert` converts between the document form and the outline form.
60
+ It never overwrites an existing output file (exit code 2).
61
+
62
+ ## Examples
63
+
64
+ - `sieve-notes index PATH` — observe the vault relations.
65
+ `--strict` exits 1 when a broken link, an ambiguous resolution or a
66
+ missing fragment is present. `--no-names` omits the link target names.
67
+ - `sieve-notes blocks FILE` — the block tree of one note.
68
+ `--dialect auto|document|outline` selects the dialect.
69
+ - `sieve-notes convert FILE --to outline|document -o OUT` — conversion.
70
+ `--indent tab|2|4` selects the item indentation (the default is two spaces).
71
+ - `sieve-notes --self-check` — verifies the bundled small sample
72
+ (exit codes 0 / 1 / 2).
73
+
74
+ From Python, the three functions `index_vault` / `block_tree` /
75
+ `convert_text` return the same shape (`notes_version: 1`).
76
+
77
+ ## Supported formats
78
+
79
+ - Internal links (aliases, headings, block IDs, embeds)
80
+ - Markdown-form relative-path links
81
+ - Block references (the `((id))` form)
82
+ - Comments (`%%…%%` and HTML comments)
83
+ - Properties (frontmatter and `key:: value` lines)
84
+ - Callouts (including folded `> [!x]-`)
85
+ - Tags
86
+ - File placement and folder layout (default exclusions:
87
+ `.obsidian/`, `.trash/`, `logseq/`, `.git/`)
88
+ - Indentation characters (one tab or two spaces per level)
89
+
90
+ The sources per format and the rules of this version live in docs:
91
+ `docs/formats.md` (supported formats and their official sources),
92
+ `docs/vocabulary.md` (the closed vocabulary and the output contract),
93
+ `docs/resolution.md` (the link resolution rules) and
94
+ `docs/convert.md` (the conversion rules and properties).
95
+
96
+ ## License
97
+
98
+ MIT License. See [LICENSE](https://github.com/neguseatama/sieve-notes/blob/main/LICENSE).
99
+
100
+ Copyright (c) 2026 Kai IWASAKI
@@ -0,0 +1,13 @@
1
+ """pytest configuration: make sieve_notes.py at the repository root importable.
2
+
3
+ The repository root is put first on sys.path so that an installed copy and a
4
+ bare pytest run use the same import path (the package is a single module
5
+ that depends only on the standard library).
6
+ """
7
+
8
+ import sys
9
+ from pathlib import Path
10
+
11
+ _ROOT = str(Path(__file__).resolve().parent)
12
+ if _ROOT not in sys.path:
13
+ sys.path.insert(0, _ROOT)
@@ -0,0 +1,91 @@
1
+ # Conversion rules and properties
2
+
3
+ `convert FILE --to outline|document -o OUT` is a pure conversion through the
4
+ block tree. It writes a new file and never modifies the original. An existing
5
+ output file is never overwritten (exit code 2, `output_exists`).
6
+
7
+ ## Indentation
8
+
9
+ - `--indent tab|2|4` selects the indentation of one level. The default is
10
+ **2** (two spaces).
11
+ - One indentation level is read as one tab or two spaces.
12
+ - The official documentation describes nesting in the outliner form through
13
+ the Tab key and does not state the indentation characters in the file
14
+ (see "Not covered" in `docs/formats.md`).
15
+
16
+ ## Document → outline
17
+
18
+ - A heading becomes an item carrying the heading marker (`- # Title`). The
19
+ content below the heading becomes its children.
20
+ - A paragraph becomes one item (the second and later lines stay as
21
+ continuation lines under the item).
22
+ - A list item becomes a child item of the preceding paragraph (or heading).
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).
26
+ - An ordered item (`1.` / `1)`) loses its number, becomes a plain item, and
27
+ is counted in `ordered_list_became_bullets`.
28
+ - A list directly under a heading (or the root) becomes a paragraph when
29
+ converted back, so `list_became_paragraphs` is reported per item.
30
+ - When a separate run split by a blank line attaches to the same parent,
31
+ `lists_merged` is reported once for each.
32
+ - Anything that cannot be mapped to the structure is not dropped; it is kept
33
+ as text (see below).
34
+
35
+ ## Outline → document
36
+
37
+ - An item that starts with a heading marker becomes a heading.
38
+ - An item with children becomes a paragraph followed by a list of the children.
39
+ - An item without children becomes a paragraph.
40
+ - Deep nesting becomes nested lists (two-space indentation, canonical form).
41
+ - When the content of an item starts with a fence, quote, table, comment or
42
+ HTML marker, it is restored as a block of literal text.
43
+ - Continuation lines are restored by stripping the item's depth + 1 levels
44
+ of indentation.
45
+ - Raw root lines (kept lines) are preserved in place, with consecutive ones
46
+ forming one block.
47
+ - Blocks are joined by exactly one blank line (canonical form).
48
+ - **Text is never split into sentences.** The unit is the paragraph and the
49
+ list item.
50
+
51
+ ## Kept (structures preserved as text)
52
+
53
+ Structures that cannot be mapped are not dropped. They are kept as literal
54
+ text and reported by kind and count with fixed words:
55
+
56
+ - `kept_as_text_fold_state` — `collapsed:: true` lines.
57
+ - `kept_as_text_block_id` — a trailing `^id` and `id:: <value>` lines.
58
+ - `kept_as_text_properties` — other `key:: value` lines.
59
+ - `kept_as_text_frontmatter` — the frontmatter block.
60
+ - `kept_as_text_unsupported` — comments (`%%…%%` and HTML comments), rules and
61
+ callouts. **Comments are counted here.**
62
+
63
+ Lines kept as raw lines (frontmatter, properties, comments, rules) are not
64
+ wrapped into items; they stay in place at column 0. As a result, observing
65
+ the output again can change the dialect detection when kept lines are
66
+ present (see the detection rule in `docs/vocabulary.md`). Callouts alone are
67
+ placed inside an item in the same form as a quote (the text does not change).
68
+
69
+ ## Properties
70
+
71
+ - **P1**: A canonical document (LF line endings, ATX headings, `-` lists, one
72
+ blank line between blocks) made only of headings, paragraphs, nested lists
73
+ with an introductory paragraph, code, tables and quotes is byte-identical
74
+ after document → outline → document.
75
+ - **P2**: For any input, every round trip after the first matches the
76
+ output of the first (a fixed point).
77
+ - A structure whose shape changes on a round trip is never changed silently;
78
+ it is reported with a fixed word and a count. The words are exactly
79
+ `list_became_paragraphs`, `ordered_list_became_bullets` and
80
+ `lists_merged`.
81
+ - The characters of the text do not change. Only the marker of a numbered item
82
+ (such as `1.`) is dropped as structure and reported in
83
+ `ordered_list_became_bullets`.
84
+
85
+ ## Exit codes
86
+
87
+ - 0 = converted (the output was written).
88
+ - 1 = with `--strict`, something was reported under `kept_as_text_*` or a
89
+ shape change (in this case the output is **not** written).
90
+ - 2 = cannot run (no input, the output exists, the encoding is not accepted,
91
+ or the dialect is already the target: `already_in_target`).
@@ -0,0 +1,41 @@
1
+ # Supported formats and sources
2
+
3
+ The formats that Sieve Notes 0.1.0 covers, with their sources (official
4
+ documentation). Formats are described by the name of the format itself. A
5
+ format that could not be confirmed in official documentation is listed under
6
+ "Not covered" and is not implemented in this version.
7
+
8
+ ## Supported formats
9
+
10
+ | Format | Source (official documentation) |
11
+ |---|---|
12
+ | Internal links `[[note]]`, aliases `[[note\|alias]]`, headings `[[note#section]]`, block IDs `[[note#^id]]`, embeds `![[file]]`, Markdown-form relative-path links `[text](path)` | Internal links — https://obsidian.md/help/links |
13
+ | Callouts (including folded `> [!faq]-` and default-open `+`) | Callouts — https://obsidian.md/help/callouts |
14
+ | Comments `%%…%%` (inline and block) and HTML comments `<!--…-->` | Comments in Obsidian Flavored Markdown — https://help.obsidian.md/syntax |
15
+ | Properties (frontmatter: YAML between `---` lines) | Properties — https://obsidian.md/help/properties |
16
+ | Tags (`#tag`, nested `#a/b`, `tags:` in frontmatter) | Tags — https://obsidian.md/help/tags |
17
+ | Vault and the settings folder `.obsidian/` | How Obsidian stores data — https://obsidian.md/help/data-storage |
18
+ | Attachment locations (default, a given folder, the note's own folder, a subfolder of it) | Attachments — https://obsidian.md/help/attachments |
19
+ | Page references `[[page name]]`, block references `((block-uuid))`, properties `property:: value` | Markdown / Properties — https://docs.logseq.com (sources: `pages/Markdown.md` and `pages/Properties.md` in https://github.com/logseq/docs) |
20
+ | Graph folders `journals`, `pages`, `assets` and the settings file `logseq/config.edn` | https://docs.logseq.com (sources: `pages/How to create a Logseq graph using existing Markdown files.md` and `pages/config edn file.md` in the same repository) |
21
+ | Outliner-form hierarchy (nesting with the Tab key) | What is indentation and why does it matter? — https://docs.logseq.com |
22
+
23
+ ## Not covered
24
+
25
+ 1. **The indentation characters of outliner-form files.** The official
26
+ description covers the Tab key operation and does not state the
27
+ indentation characters inside the file. This version defaults to two
28
+ spaces per level; `--indent tab|2|4` changes it (see `docs/convert.md`).
29
+ 2. **The org-mode form (`.org`).** Only `.md` files are covered.
30
+ 3. **`{{embed …}}`.** It is documented officially, but it is outside the
31
+ closed link vocabulary of this version (wikilink, embed, markdown_link,
32
+ block_ref), so it is not counted.
33
+ 4. **Inline `key:: value` properties in the wikilink form.** Its official
34
+ documentation covers frontmatter only. `key:: value` is adopted as
35
+ documented in the official documentation of the outliner form (the
36
+ resolution of `((id))` in `docs/resolution.md` follows the same).
37
+ 5. **Setext headings (`===` / `---` underlines).** Only ATX (`#`) headings are
38
+ covered. Lines made of underline characters are treated as a rule or as text.
39
+ 6. **Bullets starting with `+` or `*` inside blocks.** They appear in the
40
+ official bullet page, but the list marker of this version is limited to
41
+ `- `. Lines starting with `+` or `*` are treated as text (paragraphs).
@@ -0,0 +1,69 @@
1
+ # Link resolution rules
2
+
3
+ The rules by which Sieve Notes 0.1.0 resolves links. The official
4
+ documentation listed in `docs/formats.md` is the basis for these rules. Where
5
+ the documentation is silent, the rule written here is the default.
6
+
7
+ ## Name matching
8
+
9
+ - A note's name is its path relative to the vault root (POSIX form) without
10
+ the `.md` extension. Names are compared case-insensitively after NFC
11
+ normalization.
12
+ - When a link contains a path (`[[folder/name]]`), the **end** of the path
13
+ must match, on component boundaries: `a/b` matches `x/a/b` but not `x/ab`.
14
+ - An attachment is matched by its name with the extension (also by the end of
15
+ the path when a path is given). The content of an attachment is not read.
16
+ - More than one candidate gives `ambiguous`, none gives `broken`, exactly one
17
+ gives `resolved`.
18
+
19
+ ## Fragments (after `#`)
20
+
21
+ - A fragment on a link to a note is checked:
22
+ - The `#section` form: `resolved` when every part of the fragment exists
23
+ among the headings (ATX `#` strings) of the target note, otherwise
24
+ `fragment_missing`.
25
+ - The `#^id` form: `resolved` when the target note contains the block ID,
26
+ otherwise `fragment_missing`.
27
+ - **Fragments on links to attachments are not checked** (the part after `#`
28
+ or `|` in `![[document.pdf#page=3]]` or `![[image.jpg|100x145]]`).
29
+ Because attachments are not read, a matching name gives `resolved`, never
30
+ `fragment_missing`.
31
+ - The `[[#section]]` form (no path) resolves to a heading in the same note.
32
+
33
+ ## Finding block IDs
34
+
35
+ - A line ending in `^id` (ASCII letters, digits and `-`; at least three
36
+ characters; digits alone are not allowed) registers that id as a block ID
37
+ of the note.
38
+ - The value of an `id:: <value>` line (a block property) is registered as a
39
+ block ID as well (used to resolve `((id))`).
40
+
41
+ ## Resolving `((id))` (block_ref)
42
+
43
+ The `id:: <value>` lines (block properties) of the whole vault are searched:
44
+
45
+ - exactly one found: `resolved`
46
+ - none found: `broken`
47
+ - more than one found: `ambiguous`
48
+
49
+ The official documentation defines this syntax (the outliner form's block
50
+ reference `((block-uuid))`) but not how it is resolved across a vault, so the
51
+ rule above is used.
52
+
53
+ ## Not counted
54
+
55
+ - External URLs (with a scheme such as `http://`, and `mailto:` and similar).
56
+ - Links inside code blocks (within fences) and inline code (between backticks).
57
+ - The Markdown-form `[text](#section)` (an in-page reference without a path).
58
+ - Empty targets (`[[]]`, `[ ]`).
59
+
60
+ ## Other rules
61
+
62
+ - Text after `|` is an alias (display name) and is ignored.
63
+ - In Markdown-form paths, `%XX` is decoded and the `<` `>` wrapper is
64
+ removed. `./` and `../` resolve relative to the note's folder. Wikilink-form
65
+ paths are matched by suffix from the vault root.
66
+ - A self-link (a `resolved` link to the same note) is not counted as a
67
+ backlink (it is counted in the link count).
68
+ - The word `file_limit` (files beyond `--max-files`) belongs to the closed
69
+ vocabulary in `docs/vocabulary.md`.
@@ -0,0 +1,93 @@
1
+ # Closed vocabulary and output contract
2
+
3
+ The words that appear in the output of Sieve Notes 0.1.0 are limited to the
4
+ closed lists below. No other word is emitted.
5
+
6
+ ## Link kinds
7
+
8
+ - `wikilink` — `[[…]]`
9
+ - `embed` — `![[…]]`
10
+ - `markdown_link` — `[text](path)` (relative paths only; external URLs are not links here)
11
+ - `block_ref` — the `((id))` form
12
+
13
+ External URLs are not counted. Links inside code blocks and inline code are
14
+ not counted. The form `![alt](image.png)` is counted as `markdown_link`; the
15
+ word `embed` is reserved for `![[…]]`.
16
+
17
+ ## Link states
18
+
19
+ - `resolved` — resolved to exactly one target
20
+ - `broken` — no target
21
+ - `ambiguous` — more than one target
22
+ - `fragment_missing` — the note exists, but the heading or block ID does not
23
+
24
+ ## Block kinds
25
+
26
+ `heading`, `paragraph`, `list_item`, `code`, `quote`, `callout`, `table`,
27
+ `html`, `rule`, `frontmatter`, `comment`, `properties`.
28
+
29
+ Each block has a kind, a depth and a line range (1-based, both ends
30
+ inclusive). Note bodies are never emitted.
31
+
32
+ ## Dialects
33
+
34
+ - `document` — headings and paragraphs are the basic shape.
35
+ - `outline` — all top-level content is a `- ` bullet.
36
+
37
+ ### Dialect detection
38
+
39
+ After removing a leading frontmatter block, the input is `outline` when every
40
+ non-blank top-level (indent 0) line is a `- ` item or a kept line (property,
41
+ `%%` / `<!--` comment, or rule). Otherwise it is `document`.
42
+ When `--dialect` is given explicitly and differs from the detected dialect,
43
+ the exit code is 2 (`dialect_mismatch`).
44
+
45
+ ## Skip reasons
46
+
47
+ - `symlink_skipped` — symbolic links are not followed
48
+ - `too_large` — over the size limit (default 5,000,000 bytes; `--max-file-bytes`)
49
+ - `unreadable` — cannot be read (the rest of the run continues)
50
+ - `unsupported_encoding` — the encoding is not accepted (the rest of the run continues)
51
+ - `file_limit` — files beyond the file-count limit (`--max-files`, default 20,000)
52
+
53
+ By default only four folders are excluded: `.obsidian/`, `.trash/`,
54
+ `logseq/` and `.git/`. Other folders whose names start with a dot are
55
+ included. With `--include-hidden-dirs`, everything is included, including
56
+ those four. The number of excluded folders is reported as `excluded_dirs`
57
+ (an integer).
58
+
59
+ ## Conversion words
60
+
61
+ - Kept (counts of structures preserved as literal text):
62
+ `kept_as_text_fold_state` (`collapsed:: true`),
63
+ `kept_as_text_block_id` (`^id` and `id:: <value>`),
64
+ `kept_as_text_properties` (other `key:: value` lines),
65
+ `kept_as_text_frontmatter`, and
66
+ `kept_as_text_unsupported` (comments, rules, callouts and similar;
67
+ comments are counted here).
68
+ - Structures whose shape changes (exactly three words):
69
+ `list_became_paragraphs`, `ordered_list_became_bullets`, `lists_merged`.
70
+
71
+ ## Exit codes
72
+
73
+ - `index`: 0 = ran / 1 = with `--strict`, at least one of `broken`,
74
+ `ambiguous` or `fragment_missing` is present / 2 = cannot run.
75
+ - `blocks`: **0 = ran / 2 = cannot run** (1 is not used).
76
+ - `convert`: 0 = converted / 1 = with `--strict`, something was kept or
77
+ changed shape / 2 = cannot run.
78
+
79
+ ## Output contract (`notes_version: 1`)
80
+
81
+ - Output with `--format json` always contains `"notes_version": 1`.
82
+ - The public functions `index_vault(path, ...)`,
83
+ `block_tree(text=None, *, path=None, dialect="auto")` and
84
+ `convert_text(text, to, *, indent="2", strict=False)` return a dict in the
85
+ same shape as the CLI (`convert_text` additionally returns `output_text`).
86
+ - No absolute path appears in the output. Paths are relative to the given
87
+ folder (POSIX form, `/` separated).
88
+ - Per-note fields of `index`: relative path, link counts (by state), counts by
89
+ kind, backlink count, number of folded blocks, number of comments.
90
+ Contents are never emitted, only counts.
91
+ - List of broken links: the note's relative path, line number, link kind and
92
+ state word. Link target names are shown by default (intended for local
93
+ use); `--no-names` omits the name field.