Skip to content

feat: non-destructive sync, vocabulary import, simple template syntax, and improved error handling - #541

Open
nithou wants to merge 4 commits into
OGKevin:masterfrom
nithou:master
Open

feat: non-destructive sync, vocabulary import, simple template syntax, and improved error handling#541
nithou wants to merge 4 commits into
OGKevin:masterfrom
nithou:master

Conversation

@nithou

@nithou nithou commented Jun 19, 2026

Copy link
Copy Markdown

Summary

  • Non-destructive sync: Re-importing highlights no longer overwrites user content. A ## Personal
    Notes section is preserved across re-imports. Users can position it anywhere in their template.
  • Vocabulary import (My Words): Extracts looked-up words from Kobo's WordList table into a single
    vocabulary file. Dynamically detects available columns (DictSuffix, VolumeId, DateCreated) via PRAGMA
    table_info, following the existing hasBookmarkColorColumn() pattern. Controlled by two new settings:
    "Import vocabulary" and "Vocabulary file name".
  • Simple template syntax: Supports {{Title}}, {{Author}}, {{highlights}} and other shorthand
    variables as an alternative to Eta <%= it.bookDetails.title %> syntax. Both syntaxes can be mixed
    freely. Tolerant of linter-inserted spaces ({{ Title }}, { { Title } }).
  • Better error handling: Replaces the generic "Something went wrong... Check console" notice with
    specific, actionable messages. An ImportContext class tracks books imported, highlights extracted,
    vocabulary words, and warnings, presenting a summary like "Imported 12 books (347 highlights). 2
    warnings: ...".
  • Remember SQLite path (from feat: remember KoboReader.sqlite path between sessions #521 by @eton-s): Saves the KoboReader.sqlite filesystem path between
    sessions using Electron's webUtils.getPathForFile. Auto-loads on next modal open.
  • Handle missing bookTitle (from fix: handle missing bookTitle for custom books #483 by @dulangaj): Uses content.title as fallback instead of
    throwing when bookTitle is null, making the plugin resilient to custom books/articles with incomplete
    metadata.

Additional fixes

  • Fix broken click/mouseover handlers in suggestion dropdown (.bind() result was discarded, never called)
  • Fix ReadStatus.Unopened (0) rendering as "Unknown" due to falsy check
  • Await saveSettings() consistently in all settings onChange handlers
  • Remove async from all synchronous sql.js Repository methods and cascade through HighlightService
  • Replace SELECT DISTINCT with GROUP BY Title in getAllBookDetails() for deterministic deduplication
  • Fix DOM element creation order in modal; replace innerHTML with safe appendText/createEl
  • Remove blanket eslint-disable no-unused-vars from Suggest.ts
  • Fix typo "progess" → "progress" in settings
  • Remove unused moment dependency; move @types/better-sqlite3, esbuild-plugin-wat, @popperjs/core to devDependencies
  • Make repository tests database-agnostic (no longer hardcoded to specific book data)

nithou and others added 4 commits June 19, 2026 18:32
…, and better error handling

- Non-destructive sync: preserve user content under "## Personal Notes"
  section across re-imports instead of overwriting entire files
- Vocabulary import: extract looked-up words from Kobo's "My Words"
  (WordList table) into a single vocabulary file
- Simple template syntax: support {{Title}}, {{Author}}, {{highlights}}
  shorthand alongside full Eta.js syntax
- Error handling: show specific actionable error messages with import
  statistics instead of generic "Check console" notices
- Remember SQLite path: auto-load KoboReader.sqlite from stored path
  on subsequent imports (merged from PR OGKevin#521 by eton-s)
- Handle missing bookTitle: use content title as fallback instead of
  crashing on custom books/articles (merged from PR OGKevin#483 by dulangaj)
- Fix broken suggestion click/mouseover handlers, ReadStatus.Unopened
  rendering, async/sync mismatch, and other bug fixes
- Update README with new features, simple template syntax reference,
  and settings documentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The content merger now extracts the Personal Notes section by finding
the next ## heading boundary rather than consuming to EOF. This allows
the section to live anywhere in the template — typically right after
the title heading, before Description and Highlights.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ility

The shorthand preprocessor now matches `{{ Title }}` and `{ { Title } }`
in addition to `{{Title}}`. This prevents Obsidian linters or YAML
formatters from breaking template variables by inserting spaces inside
braces.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant