Commit Graph
32 Commits
Author SHA1 Message Date
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
AlexKucera 175fad5b4e Removes Afraty Stencil font
Removes the "Afraty Stencil" font from the default font stacks in the templates.

This change ensures a more consistent and reliable font rendering across different systems, as "Afraty Stencil" may not be universally available. The font stacks now prioritize more common and widely supported fonts.
2025-09-01 20:56:20 +02:00
AlexKucera c3e47b9020 Updates default and fallback fonts
Updates the default and fallback fonts in the template.

If a font is specified, it now includes "Concourse OT 3" as a fallback option.
If no font is specified, it now defaults to "Afraty Stencil" with "Concourse OT 3" as a fallback.
2025-09-01 20:47:07 +02:00
Jarvis a60b2a8efd feat(markdown): add email block support for Obsidian to Typst conversion
- Implement email block detection and parsing in MarkdownPreprocessor
- Convert Obsidian email blocks to Typst #email-block() function calls
- Add Pandoc raw blocks wrapper for proper Typst code execution
- Import email-block function in universal wrapper template
- Disable smart quotes with --from markdown-smart flag

Fixes email blocks appearing as plain text in PDF exports

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 20:34:43 +02:00
AlexKucera 00292f8146 Replaces a built-in template
Updates the list of built-in templates, replacing 'single-page.typ' with 'modern.typ'.
This change reflects a shift in the default template options, offering users a more contemporary template choice.
2025-09-01 12:04:26 +02:00
Jarvis 99f55b7ecb feat: implement universal wrapper for proper export format variable passing
- Add universal Pandoc wrapper template to handle variable substitution
- Fix export_format variable not reaching Typst templates via -V flag
- Implement single-page/multi-page format selection functionality
- Update all templates to use conditional height parameter with spread operator
- Add pluginDir to PandocOptions for proper wrapper path resolution

Technical changes:
- Create templates/universal-wrapper.pandoc.typ for Pandoc template system
- Modify buildPandocArgs to use --template instead of -V template=
- Update page layout logic in all templates using ..if export_format == "single-page"
- Replace duplicate conditional set page() blocks with single streamlined approach
- Fix type checking issues (string -> str) for consistency

Templates updated:
- default.typ: Clean minimal style with conditional height
- article.typ: Magazine-style layout with conditional height
- report.typ: Professional business format with conditional height
- modern.typ: Renamed from single-page.typ for better naming consistency

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 11:50:16 +02:00
AlexKucera 59f98a7e0f Adds sharp for image processing
Adds the `sharp` library as a dependency.

This library is used for high-performance image processing and will
be used to optimize images.
2025-09-01 10:48:06 +02:00
Jarvis 4a7831d86f refactor: remove non-functional export mode dropdown
Remove the export mode dropdown from both export modal and settings
since switching between "typography" and "style-preserving" modes
had no actual effect on PDF output.

Changes:
- Remove ExportMode enum and all references
- Remove export mode UI from modal and settings tab
- Clean up unused export_mode parameter from templates
- Remove export_mode variable passing to Pandoc
- Add "sharp" to esbuild external dependencies

This simplifies the UI and removes confusing options that didn't
work, focusing users on the functional typography settings instead.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 10:45:57 +02:00
Jarvis 3fd6dde592 fix: resolve all TypeScript build errors and improve type safety
Comprehensive fix for 26+ TypeScript compilation errors to enable successful builds:

- Update tsconfig.json: Add ES2015/ES2017 libs for iterator support
- Add missing type exports: Create central export location in CSSExtractor.ts
- Fix interface definitions: Add optimizeForPrint to MappingOptions
- Fix access modifiers: Make mapCSSProperty public in CSSToTypstMapper
- Add missing methods: getEnhancedThemeProfile and extractThemeStyles to PopularThemeSupport
- Fix null/undefined type issues: Update return types for proper TypeScript compliance
- Fix NodeList iteration: Convert to Array.from() for ES6 iterator compatibility
- Fix template validator: Resolve condition logic and index signature errors

All TypeScript compilation errors are now resolved while maintaining code functionality.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 16:10:59 +02:00
Jarvis 532bc04455 feat: add comprehensive image embed support with WebP conversion
- Implement image embed processing similar to PDF embed handling
- Add marker-based preprocessing for async image resource handling
- Support all three Obsidian image linking patterns:
  - Shortest path (filename only): ![[auf_der_couch.png]]
  - Note-relative paths: ![[2023-05-04.../image.jpeg]]
  - Vault-relative paths: ![[../attachments/image.webp]]
- Add automatic WebP to PNG conversion using ImageMagick
- Copy images to vault temp directory for Typst accessibility
- Handle multiple path resolution strategies with fallback options
- Add comprehensive error handling and logging for image processing

Resolves image export issues where only text was included in PDF exports.
Images are now properly resolved, copied, and converted as needed for
Typst compatibility.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 15:03:00 +02:00
AlexKucera e80ccca966 Marks tasks as done in taskmaster
Updates the taskmaster task list to reflect completed tasks.
This ensures that the task statuses are correctly tracked.
2025-08-31 14:45:19 +02:00
Jarvis b9fb1a455f feat: add PDF embed support with first-page preview generation
- Implement PdfToImageConverter using pdf-to-img CLI for PDF-to-image conversion
- Add PDF embed detection and processing in MarkdownPreprocessor
- Generate first-page preview images for PDF embeds in exported documents
- Copy generated images to vault location for Typst accessibility
- Add --embed-resources flag to Pandoc for proper resource embedding
- Support both image and PDF attachments in exported documents

Fixes issue where PDF exports only contained text without attachments.
PDF embeds now show visual previews like Obsidian's native behavior.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 14:39:57 +02:00
Jarvis d765f09402 fix: Process embeds before wikilinks to prevent incorrect .md extensions on images
- Reorder processing steps: embeds first, then wikilinks
- Prevents ![[image.jpg]] from becoming ![](image.jpg.md)
- Ensures image filenames remain correct for Pandoc/Typst resolution

This fixes the core issue where image files were getting .md extensions
appended, causing Typst to look for non-existent .md files instead of
the actual image files.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 17:57:31 +02:00
Jarvis c9bd4cb210 fix: Add attachment support to PDF export
- Run Pandoc from vault directory for proper path resolution
- Add --resource-path arguments for attachment directories
- Use absolute template paths when working directory is vault
- Preserve relative attachment paths in MarkdownPreprocessor
- Support common attachment folder structures (attachments/, assets/, files/, images/)

Fixes issue where exported PDFs only contained text without embedded images/attachments.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 17:50:45 +02:00
Jarvis 08b8b773c8 fix: resolve modal display and functionality issues
- Fix modal window dimensions to 1100px x 750px matching Obsidian Settings
- Fix empty modal content by reordering formContainer creation sequence
- Fix horizontal scrollbars by adjusting container CSS to use full width
- Fix empty template dropdown by loading templates before form generation
- Fix missing ribbon icon by changing from 'file-pdf' to 'download' (valid icon)
- Implement proper updateTemplateDropdown() method for dynamic population

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 07:40:55 +02:00
Jarvis 0d81bb31b4 feat: implement CSS extraction and style preservation system (task 8)
Complete implementation of comprehensive CSS extraction system for
theme-aware Typst PDF exports:

- CSSExtractor.ts: Core DOM style extraction with theme detection
- CSSToTypstMapper.ts: CSS to Typst property conversion with color parsing
- ThemeManager.ts: Theme-specific variable handling for popular themes
- PopularThemeSupport.ts: Enhanced support for Minimal, Blue Topaz, Sanctum
- PluginSpecificStyleHandler.ts: Style extraction for Dataview, Templater, etc
- HybridExportMode.ts: Main integration system with conflict resolution
- Updated index.ts to export all new components and types

System supports automatic theme detection, CSS variable extraction,
plugin-specific styling, and hybrid export modes with configurable
conflict resolution strategies.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 23:23:35 +02:00
Jarvis 83b52c6f41 feat: implement export configuration modal (task 7)
Add comprehensive ExportConfigModal class extending Obsidian Modal
with full UI for PDF export configuration including:

- Export mode selection (current note, note with dependencies, collection)
- Format selection (PDF via Pandoc+Typst, Typst source export)
- Template management with predefined and custom options
- Output settings (filename patterns, destination paths)
- Page configuration (size, orientation, margins)
- Typography settings (fonts, sizes, spacing)
- Real-time validation with visual feedback
- Settings persistence with recent export tracking
- Progress indicator with cancellation capability
- Professional CSS styling for modal appearance

Implements Task 7 and all 5 subtasks (7.1-7.5) from TaskMaster.

Note: Modal implementation complete but not yet connected to
export commands - handleExportWithDependencyCheck still shows
placeholder message and needs integration.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 23:07:10 +02:00
AlexKucera 58e0558903 Completes task implementation
Marks several tasks and subtasks as complete, indicating that the implementation phase for these features is finished.
The completed tasks include dependency checking, callout conversion, and pandoc execution enhancements.
2025-08-29 22:52:35 +02:00
Jarvis a4a13e4aeb feat: implement typst template system with validation (task 6)
Adds comprehensive template management system for Typst PDF export:

• TemplateManager: Built-in and custom template support with 4 embedded templates
• TemplateSubstitution: Variable processing with Typst character escaping
• TemplateValidator: Syntax validation, structure checks, and feature detection
• Complete TypeScript type definitions for template system

Supports Typst 0.11+ features and provides robust error handling.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 22:45:07 +02:00
Jarvis c31550920d feat: implement pandoc-typst conversion pipeline (task 5)
Implements core conversion logic from processed markdown to PDF via Pandoc
and Typst. Creates a robust pipeline with proper error handling, progress
tracking, and cleanup mechanisms.

Key features:
- PandocTypstConverter class with child_process.spawn for execution
- Comprehensive argument building for templates, variables, and options
- Temporary file management with automatic cleanup
- Timeout handling for large document processing
- Progress tracking and error message extraction
- Support for both direct PDF and intermediate .typ file generation

Technical details:
- Uses spawn instead of exec for better control and streaming
- Implements proper cleanup handlers for process termination
- Supports Pandoc 3.x API with --pdf-engine=typst
- Cross-platform compatible with proper path handling

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 22:34:36 +02:00
AlexKucera 6e1b8f38ad Updates task statuses in tasks.json
Reflects completion of MarkdownPreprocessor tasks.
Specifically, marks the initial class creation,
wikilink parsing, embed parsing, and frontmatter
processing tasks as 'done'. Also, marks callout
parsing as 'in-progress'. Updates the timestamp
for the task list.
2025-08-29 22:26:31 +02:00
Jarvis cca5c0210b feat: implement comprehensive markdown preprocessor for obsidian syntax (task 4)
Add MarkdownPreprocessor class with full Obsidian syntax conversion:
- Convert wikilinks [[file#heading|alias]] to standard markdown links
- Process embeds ![[file]] with size parameters and file type detection
- Transform callouts to enhanced blockquotes with CSS class markers
- Extract and preserve frontmatter using gray-matter library
- Enhanced tag extraction from content and frontmatter
- Comprehensive error handling and warnings system
- Optimized for Pandoc → Typst conversion pipeline

Validated against Pandoc documentation for maximum compatibility.
All preprocessing outputs standard markdown that Pandoc processes
efficiently for high-quality PDF generation via Typst.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 17:59:47 +02:00
Jarvis 7312575588 feat: implement dependency checker and external tool management (task 3)
Add comprehensive dependency checking system for external tools:

- Create DependencyChecker class with cross-platform executable detection
- Implement version validation for Pandoc (3.0.0+) and Typst (0.11.0+)
- Add timeout handling and robust error management for external processes
- Integrate dependency checking with plugin lifecycle and settings interface
- Create DependencyStatusModal with detailed status display and installation guides
- Add platform-specific installation instructions (Windows/Mac/Linux)
- Include user-friendly error messages and troubleshooting guidance
- Add dependency status section to settings with "Check Dependencies" button
- Style dependency modal with Obsidian theme-aware CSS
- Update TypeScript config to exclude reference files from compilation

The dependency checker provides non-blocking startup validation,
export workflow integration, and comprehensive user guidance for
missing or outdated external tools.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 17:41:42 +02:00
Jarvis 06c48fda86 feat: implement comprehensive settings interface and validation system (task 2)
- Add complete TypeScript interfaces for plugin configuration:
  - ExportMode and ExportFormat enums for type safety
  - Template interface for Typst template management
  - ExportConfig interface for per-export configurations
  - Comprehensive obsidianTypstPDFExportSettings interface
- Implement robust settings persistence with validation and migration
- Replace placeholder settings UI with full Obsidian Setting API implementation:
  - External tools configuration (Pandoc/Typst paths, output folder)
  - Export defaults (template, format, mode selection)
  - Typography settings (font families and sizing)
  - Page setup controls (size, orientation, margins)
  - Behavior toggles (auto-open, folder structure preservation)
- Add DEFAULT_SETTINGS with sensible defaults for all configuration options
- Implement validateSettings() and migrateSettings() for data integrity

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 17:24:20 +02:00
AlexKucera 50c47a3cc7 Excludes Serena cache directory from Git tracking
Prevents accidental inclusion of the Serena cache directory in Git repositories.
Removes a specific document symbols cache file.
2025-08-29 17:12:46 +02:00
AlexKucera ca587f8363 Adds initial Serena setup and memories
Initializes project with core configuration files.

Adds memories for code style conventions, codebase structure,
development guidelines, project overview, suggested commands,
task completion checklist, and tech stack.
These memories will help guide development and ensure consistency.
2025-08-29 17:04:31 +02:00
AlexKucera 2f242b4c5e Initializes plugin structure
Sets up the foundational structure for the Obsidian Typst
PDF Export plugin.

Removes sample plugin code and fixes initial TypeScript type
declarations, establishing a clean starting point.

Configures the plugin manifest and settings infrastructure,
laying the groundwork for future development.

Adds task complexity report.
2025-08-29 17:04:15 +02:00
Jarvis ca729e5037 feat: clean up template code and establish plugin foundation (task 1)
- Fix TypeScript type inconsistencies in main.ts
- Remove sample template components (SampleModal, sample commands)
- Replace sample settings tab with TypstPDFExportSettingTab
- Update package.json metadata to reflect actual plugin identity
- Add basic plugin structure with export command and ribbon icon
- Clean up template comments and unused imports

This establishes a clean foundation for implementing Typst PDF export
functionality by removing all sample plugin template code and setting
up proper plugin structure with placeholder functionality.

Addresses all subtasks in task 1 (1.1-1.5) from project roadmap.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 17:03:34 +02:00
AlexKucera c315d31011 Original PRD
Introduces a product requirements document (PRD) for the Obsidian Typst PDF Export plugin.

The PRD outlines the plugin's goals, core features, technical architecture, user experience, implementation phases, and success metrics. It also covers technical considerations, future enhancements, risks, and appendices detailing Obsidian syntax support, template variables, and CSS to Typst mapping examples.
2025-08-29 16:26:38 +02:00
AlexKucera 08896fde48 Initializes Taskmaster AI project
Sets up the core structure and configuration
files for the Taskmaster AI project, including agents,
commands, configurations, and a project-specific
Claude integration guide.
2025-08-29 16:24:40 +02:00
AlexKucera a3c430183e Initial Setup
Sets up the basic structure for an Obsidian plugin
designed to export notes to Typst-generated PDFs.

This commit includes:
- Initial plugin manifest and configuration.
- Placeholder plugin class and settings.
- Basic .gitignore to exclude common files.
- Claude.md file to guide Claude AI on development

Task Master is imported for dev workflow.
2025-08-29 16:23:28 +02:00
AlexKucera 57c155d7cd Initial commit 2025-08-29 15:27:09 +02:00