Commit Graph
9 Commits
Author SHA1 Message Date
AlexKucera d56cb98d51 Refactors path conversion to simplify logic
Replaces manual conversion of absolute paths to vault-relative paths with a utility method to improve code readability and maintainability across various modules. Removes redundant code and streamlines path handling operations.

This refactoring helps ensure consistent path management and reduces potential errors related to path conversion.

Relates to obsidian-bot-review
2025-11-08 19:01:42 +01:00
AlexKucera 2c4076f3c9 Applies Obsidian linter and fixes code issues
Applies linting rules to the codebase and resolves identified issues.

Addresses:
- Renamed headings in settings tabs to improve UI consistency and style.
- Resolved require() style imports
- Added void operator to ensure correct promise handling.
- Replaced deprecated Obsidian API calls.
- Enforces sentence case to enhance UI text consistency.
2025-11-05 13:46:06 +01:00
Jarvis e084ff38cb fix(TemplateManager): Convert absolute path to vault-relative for adapter.list()
- Fixed adapter.list() call to use vault-relative path instead of absolute templatesPath
- Added proper path conversion by stripping vault base path and leading separators
- Ensures compatibility with Obsidian's vault.adapter API requirements
- Prevents potential file listing failures due to incorrect path format
- Maintains cross-platform path handling with proper separator normalization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 16:32:21 +02:00
Jarvis 4498281b7d refactor: migrate TemplateManager to use vault.adapter
- Replaced basePath hack with PathUtils.getVaultPath() and getPluginDir()
- Replaced fs.existsSync with vault.adapter.exists() via PathUtils.fileExists()
- Replaced fs.readdirSync with vault.adapter.list() for directory listing
- Replaced fs.readFileSync with vault.adapter.read() for template content
- Replaced path.join with PathUtils.joinPath() for consistent normalization
- Removed fs import and all direct filesystem operations
- All template operations now use proper Obsidian API methods

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 12:07:31 +02:00
Jarvis 7f54320e4c fix: resolve TypeScript build errors introduced in c13e48a
Fixes 23 TypeScript errors in 8 files by properly handling type assertions
and template variable types:

**DataAdapter Casting Issues (8 fixes):**
- Use double assertion `as unknown as { basePath: string }` instead of
  direct casting to avoid TypeScript's type overlap validation
- Files: BinaryLocator, ExportOrchestrator, PathResolver, PluginLifecycle, TemplateManager

**Template Variables Type Issues (15 fixes):**
- Add `undefined` to Record<string, string|number|boolean> union type
- Convert template variable values to appropriate types before passing to UI methods:
  - String() for dropdown setValue() methods
  - Number() for slider setValue() methods
- Update interface definitions in modalTypes.ts and ModalState.ts

The double assertion pattern is required because basePath exists at runtime
in Obsidian's FileSystemAdapter but isn't in the TypeScript definitions.
Adding undefined to template variables properly handles uninitialized values.

All changes maintain full functionality while ensuring type safety.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 22:01:16 +02:00
Jarvis c13e48a615 refactor: replace explicit any types for Obsidian plugin review compliance
Replace all @typescript-eslint/no-explicit-any warnings with proper type assertions
and union types to meet Obsidian plugin review requirements.

Changes:
- Replace (adapter as any).basePath with (adapter as { basePath: string }).basePath
- Change template variable types from Record<string, any> to Record<string, string | number | boolean>
- Change frontmatter types from Record<string, any> to Record<string, unknown>
- Fix error handling in PdfCliExecutor with proper type assertion
- Update method signatures in TypstVariableMapper for type safety

This eliminates all 42 @typescript-eslint/no-explicit-any warnings while
maintaining full functionality and improving type safety.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 18:04:29 +02:00
AlexKucera 5519c98957 Improves plugin directory path handling dynamically
Updates file path resolution to use plugin manifest directory dynamically

Replaces hardcoded plugin directory paths with more flexible approach
- Uses `this.manifest.dir!` to determine plugin directory
- Supports better cross-platform and installation compatibility
- Removes static path references in multiple plugin components

Enhances plugin robustness by making directory paths more configurable
2025-09-05 17:56:56 +02:00
AlexKucera 3cff3ff70a Renames plugin to "Typst PDF Export"
Updates the plugin's name from "Obsidian Typst PDF Export" to "Typst PDF Export".

This change simplifies the plugin's identifier and display name,
making it more concise and user-friendly. It involves updates to
the manifest file, plugin configuration, and references within the
codebase.
2025-09-05 16:57:23 +02:00
Jarvis 172a69161d feat: refactor export system and improve PDF/email handling
Major improvements to PDF export functionality and code organization:

- BREAKING: Refactor main.ts from 4224 to 994 lines by extracting modular components
- Replace broken PDF links with proper Typst pdf.embed() attachments
- Filter out unnecessary "Open:" links and Mail.app links from exports
- Fix duplicate title issue by replacing frontmatter title with filename
- Move temp file processing from system temp to plugin folder
- Clean up temp-images and temp-pandoc directories after export
- Remove timestamp from export filenames to match note names exactly
- Handle Unicode line separators (0x2028, 0x2029) in email content
- Improve markdown preprocessing with better frontmatter handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 17:16:55 +02:00