mirror of
https://github.com/adanielnoel/obsidian-index-notes.git
synced 2026-07-22 10:10:26 +00:00
Fixed bug where unchecking the 'Show title property in index' setting still showed the titles
This commit is contained in:
parent
93834a0703
commit
7edc08092b
2 changed files with 54 additions and 3 deletions
51
CLAUDE.md
Normal file
51
CLAUDE.md
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Essential Commands
|
||||
|
||||
- **Development**: `npm run dev` - Starts esbuild in watch mode for hot reloading during development
|
||||
- **Build**: `npm run build` - Runs TypeScript type checking and creates production build
|
||||
- **Version**: `npm run version` - Bumps version in manifest.json and versions.json, then stages files for commit
|
||||
|
||||
## Project Architecture
|
||||
|
||||
This is an **Obsidian plugin** that automatically generates and maintains index blocks within notes based on hierarchical tags. The plugin scans the vault for notes with specific tag patterns and creates organized, nested lists of links.
|
||||
|
||||
### Core Components
|
||||
|
||||
- **`main.ts`** - Plugin entry point that handles initialization, settings, commands, and the "New note with same location and tags" feature
|
||||
- **`src/indexer.ts`** - Core indexing engine containing the `IndexUpdater` class and `Node` tree structure for building indices
|
||||
- **`src/settings/Settings.ts`** - Settings interface and UI tab for configuring plugin behavior
|
||||
- **`src/settings/FolderSuggester.ts`** - UI component for folder selection in settings
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- **Index Notes**: Notes tagged with `/idx` suffix automatically get index blocks generated
|
||||
- **Meta Index Notes**: Notes tagged with `/meta_idx` suffix get indices of other index notes
|
||||
- **Block References**: Each index is inserted with a unique block reference (e.g., `^indexof-projects`) for reliable updates
|
||||
- **Tag Hierarchy**: Tags like `#projects/university/thesis` create nested index structures
|
||||
- **Priority Tags**: Configurable tags that push notes to the top of index sections (formatted in bold)
|
||||
|
||||
### Build System
|
||||
|
||||
- Uses **esbuild** for fast bundling with TypeScript compilation
|
||||
- Configured for Obsidian-specific externals (obsidian, electron, CodeMirror packages)
|
||||
- Development mode includes inline sourcemaps and watch mode
|
||||
- Production builds exclude sourcemaps and enable tree shaking
|
||||
|
||||
### Update Mechanism
|
||||
|
||||
The plugin runs on a configurable interval (default 5 seconds) to:
|
||||
1. Scan all vault files for tag changes
|
||||
2. Build a tree structure from hierarchical tags
|
||||
3. Generate formatted markdown index blocks
|
||||
4. Update existing blocks using block references or append new ones
|
||||
|
||||
## Development Notes
|
||||
|
||||
- TypeScript with strict null checks enabled
|
||||
- No ESLint/Prettier configuration currently set up
|
||||
- Dependencies include dateformat and YAML for metadata template processing
|
||||
- Plugin settings support folder exclusion, custom tag names, and metadata templates
|
||||
- Error handling implemented throughout with console logging
|
||||
|
|
@ -124,7 +124,7 @@ class Node {
|
|||
getIndex(indexNote: TFile, indentLevel: number = 0): string {
|
||||
let indexTxt = this.priorityNotes.concat(this.regularNotes, this.indexNotes).filter(note => note.path !== indexNote.path).map(note => {
|
||||
const mdLink = this.app.fileManager.generateMarkdownLink(note, indexNote.path, undefined, filenameToHeader(note.name));
|
||||
const noteTitle = getNoteTitle(note, this.app, ": ");
|
||||
const noteTitle = this.settings.show_note_title ? getNoteTitle(note, this.app, ": ") : "";
|
||||
return `> ${'\t'.repeat(indentLevel)}- ${this.priorityNotes.includes(note) ? '**' : ''}${mdLink}${noteTitle}${this.priorityNotes.includes(note) ? '**' : ''}\n`;
|
||||
}).join('');
|
||||
|
||||
|
|
@ -153,13 +153,13 @@ class Node {
|
|||
|
||||
[...priorityNotes].sort((a, b) => compareStrings(a.name, b.name)).forEach(note => {
|
||||
const mdLink = this.app.fileManager.generateMarkdownLink(note, indexNote.path, undefined, filenameToHeader(note.name));
|
||||
const noteTitle = getNoteTitle(note, this.app, ": ");
|
||||
const noteTitle = this.settings.show_note_title ? getNoteTitle(note, this.app, ": ") : "";
|
||||
indexTxt += `> \n> > [!tldr] ${mdLink}${noteTitle}\n`;
|
||||
});
|
||||
|
||||
[...notes].sort((a, b) => compareStrings(a.name, b.name)).forEach(note => {
|
||||
const mdLink = this.app.fileManager.generateMarkdownLink(note, indexNote.path, undefined, filenameToHeader(note.name));
|
||||
const noteTitle = getNoteTitle(note, this.app, ": ");
|
||||
const noteTitle = this.settings.show_note_title ? getNoteTitle(note, this.app, ": ") : "";
|
||||
indexTxt += `> \n> > [!example] ${mdLink}${noteTitle}\n`;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue