Skip to content

Commit

Permalink
Merge pull request #17 from iiz00/develop
Browse files Browse the repository at this point in the history
option to show only exactly matched files
  • Loading branch information
iiz00 authored May 13, 2023
2 parents 4dff07c + 3f375d1 commit 613e779
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ Indentation is added according to the level of the heading.
#### Tasks: Add checkbox text to prefix
Append a string indicating the status of the checkbox to the end of the task prefix.

### Others
#### Show only .md files / exactly matched files
If you are using the beta version of the Periodic Notes plugin, a wider range of file names will be recognized as periodic notes. Each of these options hides files that are not md files or files that do not match the format.

### Debug
#### show debug information
If turned on, some debug infromation is displayed in the console.
Expand Down Expand Up @@ -208,6 +212,9 @@ If you like my plugin, I would appreciate it if you could buy me a cup of coffee
- better preview

## Changelog
- 1.2.0
- Improvement
- If you are using the beta version of the Periodic Notes plugin, a wider range of file names will be recognized as periodic notes. If you turn on `Settings -> others -> Show only exactly matched files`, you will see only files that exactly match the format.
- 1.1.1
- Fixed
- Fixed a problem that sometimes caused non .md files to be displayed unintentionally (you can redisplay them from settings -> others -> show only .md files).
Expand Down Expand Up @@ -457,6 +464,10 @@ headingsのprefixを入力した場合、この項目をオンにすると、見
#### Tasks: Add checkbox text to prefix
タスクのprefixの最後にcheckboxの状態を示す文字列を付加します。

### Others
#### Show only .md files / exactly matched files
Periodic Notesプラグインのベータ版を使用している場合、より幅広いファイル名がperiodic notesとして認識されます。これらのオプションはそれぞれmdファイル以外、フォーマットに合致しないファイルを非表示にします。

### Debug
#### show debug information
オンにするとデバッグのためのいくつかの情報をconsoleに表示します。
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-daily-note-outline",
"name": "Daily Note Outline",
"version": "1.1.1",
"version": "1.2.0",
"minAppVersion": "0.15.0",
"description": "Add a custom view which shows outline of multiple daily notes with headings, links, tags and list items",
"author": "iiz",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-daily-note-outline",
"version": "1.1.1",
"version": "1.2.0",
"description": "Add a custom view which shows outline of multiple daily notes with headings, links, tags and list items",
"main": "main.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface DailyNoteOutlineSettings {
viewPosition: string; //right || left || tab || split || popout

markdownOnly: boolean;
exactMatchOnly: boolean;

wordsToIgnore:{ //filter
heading: string[];
Expand Down Expand Up @@ -141,6 +142,7 @@ export const DEFAULT_SETTINGS: DailyNoteOutlineSettings = {
viewPosition: 'right',

markdownOnly: true,
exactMatchOnly: false,

wordsToIgnore:{
heading: [],
Expand Down
14 changes: 14 additions & 0 deletions src/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,20 @@ export class DailyNoteOutlineSettingTab extends PluginSettingTab {
})
});

new Setting(containerEl)
.setName("Show only exactly matched files")
.setDesc("Turn on if you do not want to see files that do not exactly match the format")
.addToggle((toggle) => {
toggle
.setValue(this.plugin.settings.exactMatchOnly)
.onChange(async (value) => {
this.plugin.settings.exactMatchOnly = value;
this.display();
await this.plugin.saveSettings();
this.plugin.view.refreshView(false,false,true);
})
});


this.containerEl.createEl("h4", {
text: "Debug",
Expand Down
8 changes: 6 additions & 2 deletions src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,12 @@ export class DailyNoteOutlineView extends ItemView implements IDailyNoteOutlineS
while (checkDate.isSameOrAfter(checkDateEarliest,granularity)){
const caches = this.app.plugins.getPlugin("periodic-notes").cache.getPeriodicNotes(calendarSet.id,granularity,checkDate);
for (const file of caches){
//厳密にマッチしたファイル出なければスキップ
if ( this.settings.exactMatchOnly && !file?.matchData?.exact) {
continue;
}
//ファイルパスが.mdで終わらなければ(マークダウンファイルでなければ)スキップ
if (this.settings.markdownOnly && !file.filePath.endsWith(".md")){
if (this.settings.markdownOnly && !file?.filePath.endsWith(".md")){
continue;
}
// ファイルパスにPNのフォルダパスが含まれていない && PNのフォルダパスが指定されている のときは処理をスキップ
Expand Down Expand Up @@ -325,7 +329,7 @@ export class DailyNoteOutlineView extends ItemView implements IDailyNoteOutlineS
const element:OutlineData = {
typeOfElement : "link",
position : cache.links[j].position,
//マークダウンリンク に対応
//マークダウンリンクに対応
displayText :
(cache.links[j].displayText =="")
? cache.links[j].original.substring(1,cache.links[j].original.indexOf("]"))
Expand Down

0 comments on commit 613e779

Please sign in to comment.