Skip to content

Commit 87163d9

Browse files
authored
Merge pull request #4 from ongaeshi/develop-0.2.0
0.2.0
2 parents 77dfd83 + 6adf411 commit 87163d9

39 files changed

Lines changed: 3957 additions & 2559 deletions

.agent/rules/project-rules.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
# Language Usage
6+
7+
- Task (`task.md`), Implementation Plan (`implementation_plan.md`), and Walkthrough (`walkthrough.md`) must ALWAYS be written in **Japanese**.
8+
9+
# Commit Message Guidelines
10+
11+
1. English is preferred (standard convention).
12+
2. All commit messages must be written in English.
13+
3. The first letter immediately following the commit prefix (e.g., `feat: `, `fix: `) must be capitalized.
14+
15+
# Writing Style Guidelines
16+
17+
The style and tone of comments and commit messages should adhere to the following guides:
18+
- [Google Technical Writing Guidelines](https://developers.google.com/tech-writing)
19+
- [GitLab Technical Writing Fundamentals](https://docs.gitlab.com/ee/development/documentation/styleguide/word_choice.html)
20+
21+
Key principles include:
22+
- Be clear, concise, and direct.
23+
- Use active voice.
24+
- Avoid unnecessary jargon or overly complex phrasing.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enforce LF for test vault files
2+
tests/vault/** text eol=lf

HISTORY.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# History
2+
3+
## 0.2.0 (2026-03-02)
4+
- **Insert note**: Insert the selected note into the sequence.
5+
- **Insert note to first**: Insert the selected note at the beginning of the sequence.
6+
- **Insert note to last**: Insert the selected note at the end of the sequence.
7+
- **Detach note**: Detaches a note by setting its `previous` property to `ROOT`.
8+
9+
## 0.1.0 (2025-12-05)
10+
- **Go to previous note**: Jump to the note specified in the `previous` property of the current note's frontmatter.
11+
- **Go to next note**: Move to notes that backlink to the current note and have their `previous` property pointing to it.
12+
If multiple candidates exist, a suggestion modal will appear for selection.
13+
- **Go to first note**: Follow the `previous` property chain to reach the first note in the sequence.
14+
- **Go to last note**: Use backlinks to find the last note in the sequence.
15+
If multiple candidates exist, a suggestion modal will appear for selection.

README.ja.md

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,42 @@
1-
# Previous River
2-
3-
Obsidian のノートに前後関係を設定することができるプラグインです。
4-
ユーザーがフロントマターに設定した`previous` プロパティとバックリンクに基づいてノート間を移動できます。
5-
6-
<img width="640" src="https://github.com/user-attachments/assets/db3d5466-affd-43de-aebe-b5d4757e08ac" />
7-
8-
## 機能
9-
### 前のノートに移動(Go to Previous Note)
10-
現在のノートのフロントマターにある `previous` プロパティでリンクされたノートに移動します。
11-
12-
### 次のノートに移動(Go to Next Note)
13-
現在のノートにバックリンクを持ち、かつその `previous` プロパティが現在のノートを指しているノートに移動します。
14-
候補が複数ある場合は、選択用のモーダルが表示されます。
15-
16-
### 最初のノートに移動(Go to First Note)
17-
`previous` プロパティのチェーンをたどり、シーケンス内の最初のノートに移動します。
18-
19-
### 最後のノートに移動(Go to Last Note)
20-
次のノートをたどり、シーケンス内の最後のノートに移動します。
21-
候補が複数ある場合は、選択用のモーダルが表示されます。
22-
23-
## ホットキーの例
24-
特に「前のノートに移動」と「次のノートに移動」にホットキーを設定しておくことをおすすめします!
25-
26-
- **前のノートに移動**: `Alt+,`
27-
- **次のノートに移動**: `Alt+.`
28-
- **最初のノートに移動**: `Alt+Shift+,`
29-
- **最後のノートに移動**: `Alt+Shift+.`
30-
31-
### コントリビュート
32-
1+
# Previous River
2+
3+
Obsidian のノートに前後関係を設定することができるプラグインです。
4+
ユーザーがフロントマターに設定した`previous` プロパティとバックリンクに基づいてノート間を移動できます。
5+
6+
<img width="640" src="https://github.com/user-attachments/assets/db3d5466-affd-43de-aebe-b5d4757e08ac" />
7+
8+
## 機能
9+
### Go to previous note(前のノートに移動)
10+
現在のノートのフロントマターにある `previous` プロパティでリンクされたノートに移動します。
11+
12+
### Go to next note(次のノートに移動)
13+
現在のノートにバックリンクを持ち、かつその `previous` プロパティが現在のノートを指しているノートに移動します。
14+
候補が複数ある場合は、選択用のモーダルが表示されます。
15+
16+
### Go to first note(最初のノートに移動)
17+
`previous` プロパティのチェーンをたどり、シーケンス内の最初のノートに移動します。
18+
19+
### Go to last note(最後のノートに移動)
20+
次のノートをたどり、シーケンス内の最後のノートに移動します。
21+
候補が複数ある場合は、選択用のモーダルが表示されます。
22+
23+
### Insert notes(ノートの挿入)
24+
ノートを現在の連続したシーケンスに挿入します。
25+
- **Insert note**: 選択したノートをシーケンスに挿入します。
26+
- **Insert note to first**: 選択したノートをシーケンスの先頭に挿入します。
27+
- **Insert note to last**: 選択したノートをシーケンスの最後に挿入します。
28+
29+
### Detach note(ノートの切り離し)
30+
現在のノートの `previous` プロパティを `ROOT` に設定することで、シーケンスから切り離します。
31+
32+
## ホットキーの例
33+
特に「前のノートに移動」と「次のノートに移動」にホットキーを設定しておくことをおすすめします!
34+
35+
- **Go to previous note**: `Alt+,`
36+
- **Go to next note**: `Alt+.`
37+
- **Go to first note**: `Alt+Shift+,`
38+
- **Go to last note**: `Alt+Shift+.`
39+
40+
### コントリビュート
41+
3342
バグ報告や機能リクエストは Issues で受け付けています。プルリクエストも歓迎します!

README.md

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
1-
# Previous River
2-
3-
An Obsidian plugin that enables navigation between notes using the `previous` property in frontmatter or backlinks.
4-
5-
<img width="640" src="https://github.com/user-attachments/assets/db3d5466-affd-43de-aebe-b5d4757e08ac" />
6-
7-
## Features
8-
9-
### Go to previous note
10-
Jump to the note specified in the `previous` property of the current note's frontmatter.
11-
12-
### Go to next note
13-
Move to notes that backlink to the current note and have their `previous` property pointing to it.
14-
If multiple candidates exist, a suggestion modal will allow you to choose.
15-
16-
### Go to first note
17-
Follow the `previous` property chain to reach the first note in the sequence.
18-
19-
### Go to last note
20-
Use backlinks to find the last note in the sequence.
21-
If there are multiple candidates, a suggestion modal will appear for selection.
22-
23-
## Recommended Hotkeys
24-
25-
- **Go to previous note**: `Alt+,`
26-
- **Go to next note**: `Alt+.`
27-
- **Go to first note**: `Alt+Shift+,`
28-
- **Go to last note**: `Alt+Shift+.`
29-
30-
## Contributing
31-
1+
# Previous River
2+
3+
An Obsidian plugin that enables navigation between notes using the `previous` property in frontmatter or backlinks.
4+
5+
<img width="640" src="https://github.com/user-attachments/assets/db3d5466-affd-43de-aebe-b5d4757e08ac" />
6+
7+
## Features
8+
9+
### Go to previous note
10+
Jump to the note specified in the `previous` property of the current note's frontmatter.
11+
12+
### Go to next note
13+
Move to notes that backlink to the current note and have their `previous` property pointing to it.
14+
If multiple candidates exist, a suggestion modal will allow you to choose.
15+
16+
### Go to first note
17+
Follow the `previous` property chain to reach the first note in the sequence.
18+
19+
### Go to last note
20+
Use backlinks to find the last note in the sequence.
21+
If there are multiple candidates, a suggestion modal will appear for selection.
22+
23+
### Insert notes
24+
Insert notes into the current backlink sequence.
25+
- **Insert note**: Insert the selected note into the sequence.
26+
- **Insert note to first**: Insert the selected note at the beginning of the sequence.
27+
- **Insert note to last**: Insert the selected note at the end of the sequence.
28+
29+
### Detach note
30+
Detach the current note from the sequence by setting its `previous` property to `ROOT`.
31+
32+
## Recommended Hotkeys
33+
34+
- **Go to previous note**: `Alt+,`
35+
- **Go to next note**: `Alt+.`
36+
- **Go to first note**: `Alt+Shift+,`
37+
- **Go to last note**: `Alt+Shift+.`
38+
39+
## Contributing
40+
3241
Feel free to submit bug reports and feature requests via Issues. Contributions through pull requests are also highly appreciated!

lib/ConfirmModal.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { App, Modal, Setting } from "obsidian";
2+
3+
export class ConfirmModal extends Modal {
4+
constructor(
5+
app: App,
6+
private title: string,
7+
private message: string,
8+
private onConfirm: () => void
9+
) {
10+
super(app);
11+
}
12+
13+
onOpen() {
14+
const { contentEl } = this;
15+
contentEl.createEl("h2", { text: this.title });
16+
contentEl.createEl("p", { text: this.message });
17+
18+
new Setting(contentEl)
19+
.addButton((btn) =>
20+
btn
21+
.setButtonText("Cancel")
22+
.onClick(() => {
23+
this.close();
24+
})
25+
)
26+
.addButton((btn) =>
27+
btn
28+
.setButtonText("Confirm")
29+
.setCta()
30+
.onClick(() => {
31+
this.close();
32+
this.onConfirm();
33+
})
34+
);
35+
}
36+
37+
onClose() {
38+
const { contentEl } = this;
39+
contentEl.empty();
40+
}
41+
}

lib/NextNoteSuggestModal.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
import { SuggestModal, App, TFile } from "obsidian";
2-
3-
export class NextNoteSuggestModal extends SuggestModal<TFile> {
4-
constructor(app: App, private options: TFile[], private onSelect: (file: TFile) => void) {
5-
super(app);
6-
}
7-
8-
getSuggestions(query: string): TFile[] {
9-
// query に部分一致するものだけ返す(簡易絞り込み)
10-
return this.options.filter(file => file.basename.toLowerCase().includes(query.toLowerCase()));
11-
}
12-
13-
renderSuggestion(file: TFile, el: HTMLElement) {
14-
el.createEl("div", { text: file.basename });
15-
}
16-
17-
onChooseSuggestion(file: TFile, evt: MouseEvent | KeyboardEvent) {
18-
this.onSelect(file);
19-
}
20-
}
1+
import { FuzzySuggestModal, App, TFile } from "obsidian";
2+
3+
export class NextNoteSuggestModal extends FuzzySuggestModal<TFile> {
4+
constructor(app: App, private options: TFile[], private onSelect: (file: TFile) => void, placeholderText?: string) {
5+
super(app);
6+
if (placeholderText) {
7+
this.setPlaceholder(placeholderText);
8+
}
9+
}
10+
11+
getItems(): TFile[] {
12+
return this.options;
13+
}
14+
15+
getItemText(file: TFile): string {
16+
return file.path.endsWith(".md") ? file.path.slice(0, -3) : file.path;
17+
}
18+
19+
onChooseItem(file: TFile, evt: MouseEvent | KeyboardEvent) {
20+
this.onSelect(file);
21+
}
22+
}

0 commit comments

Comments
 (0)