- Replace hardcoded '.obsidian' paths with Vault#configDir for proper config directory support
- Move inline styles to CSS classes for better theme compatibility
- Remove unnecessary type casting by using proper type predicates
- Add proper TypeScript type narrowing for filtered arrays
This addresses all required issues identified by the Obsidian Review Bot:
* TempDirectoryManager now accepts configDir parameter from app.vault.configDir
* PdfToImageConverter uses configDir instead of hardcoded '.obsidian'
* ExportConfigModal uses CSS classes (.export-progress-visible, .export-form-hidden) instead of inline styles
* Progress bar width controlled via CSS custom property --progress-width
* Removed 'as TFile[]' casting by implementing isMarkdownFile type predicate
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
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.
Removes console log statements related to template extraction.
These logs were primarily for debugging and are no longer needed in the production code.
Updates the export file function to utilize the new settings structure for page setup and typography.
This change ensures consistency with the modal settings and simplifies the configuration process.
Implements dual-strategy template distribution for reliable plugin deployment:
Template Embedding System:
- Add esbuild plugin to embed .typ templates as base64 strings in main.js
- Create EmbeddedTemplateManager for automatic template extraction
- Add TypeScript declarations for virtual template-embed module
- Templates auto-extract on plugin load if missing from disk
Release Automation:
- Add GitHub Actions workflow for automated ZIP releases
- Create package-plugin.js script for complete distribution packages
- Update version-bump.mjs for Obsidian-compliant tags (no 'v' prefix)
- Ensure releases include templates/ directory for manual installations
Documentation Updates:
- Comprehensive installation instructions with troubleshooting
- Clear warnings about requiring complete ZIP packages
- Multiple installation methods including manual and automated
This ensures the plugin works regardless of installation method:
- ZIP releases provide templates/ directory (primary method)
- Embedded templates auto-extract as fallback (secondary method)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Improves template resolution for Typst exports by adding the plugin's templates directory as a resource path. This allows Typst to correctly locate and utilize template files within the plugin.
Updates the template path handling to use relative paths from the vault root, ensuring proper import behavior within Typst.
Removes the default hotkeys assigned to the export commands.
This allows users to define their own preferred hotkeys
without being restricted by default settings.
- Add embedPdfFiles setting to control PDF attachment embedding
- Add printFrontmatter setting to display frontmatter as formatted text
- Implement frontmatter formatting with proper line breaks and bullet lists
- Add settings toggles to both plugin settings and export modal
- Fix filename sanitization for PDF preview images with spaces
- Ensure modal export config includes new behavior settings
- Always generate PDF preview images regardless of embedding setting
The frontmatter display formats long comma-separated values (like email lists)
as bulleted lists and adds proper line breaks after each property label.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Specifies the types for data and close events in process handlers.
This improves code clarity and maintainability by ensuring that the
data received from stdout and stderr streams is treated as a Buffer,
and the close event receives a number or null for the exit code.
Refactors file access operations to use asynchronous methods
instead of synchronous ones. This enhances performance and
responsiveness by preventing blocking operations, especially
during file system interactions.
The changes involve using `fs.promises.access` instead of
`fs.existsSync` and `fs.promises.mkdir` instead of
`fs.mkdirSync`. This ensures non-blocking file system operations
across the application, improving the overall user experience.
Consolidates the export files and export files with configuration functionalities into a shared `processBatchExport` method.
This reduces code duplication and improves maintainability
by centralizing the batch processing logic.
Improves error handling when creating directories,
loading, and saving settings. This prevents crashes and
provides more informative error messages to the user.
Adds a try-catch block to `fs.statSync` to handle cases where a
file might be deleted between `readdirSync` and `statSync`,
preventing program termination.
Notifies the user when font caching fails, providing different levels of detail depending on whether debug mode is enabled.
This helps the user to be aware of potential font rendering issues and provides guidance on how to troubleshoot them.
Ensures temporary directories are cleaned up when the plugin loads and unloads, preventing potential issues from leftover files.
This addresses potential accumulation of temp files from previous sessions and on plugin disable.
Enhances security by validating output paths and executable paths.
This prevents path traversal attacks and command injection vulnerabilities
by ensuring that users can only specify valid relative paths within the vault
and safe executable paths. It also displays notices when the path is deemed unsafe.
Introduces a helper function to streamline the creation of margin input settings in the plugin settings tab. This improves code readability and reduces redundancy.
Uses a helper method to create the font dropdown settings, reducing code duplication and improving maintainability.
The shared logic for setting up font selection dropdowns is now encapsulated in a single function.
Improves the font caching mechanism by using `child_process.spawn` instead of `child_process.exec` for enhanced security and reliability. This change also adds error handling for process spawning failures and includes the ability to set environment variables such as PATH.
Moves components and modules to more appropriate directories.
This change improves project organization and maintainability by grouping related files into logical directories, enhancing code discoverability and reducing potential naming conflicts.
Moves components and converters to more appropriate directories for better code organization.
Adds a dedicated function for copying images to the vault temp directory and generating relative paths, reducing code duplication and simplifying PDF embedding.
Introduces a helper function to generate Typst PDF embed syntax, including optional preview images and error handling.
This improves code readability and maintainability by centralizing the PDF embed logic.
Simplifies PDF embed processing by introducing a dedicated
`resolvePdfPath` method. This improves code readability and
maintainability by encapsulating the logic for finding PDF files
using different path resolution strategies. It also makes it easier to
test the path resolution logic independently.
Centralizes temporary directory creation and cleanup using a dedicated `TempDirectoryManager` class.
This change improves code maintainability and reduces redundancy by encapsulating temporary directory logic.
It also ensures that temporary directories are properly cleaned up after export operations, preventing potential disk space issues.
Introduces `ExportErrorHandler` to manage export-related errors, progress notices, and batch results.
This change provides a unified way to handle errors, display progress, and report results of export operations, improving code maintainability and user experience.
Introduces a helper class to encapsulate the logic for preparing the export configuration modal settings.
This improves code readability and maintainability by extracting the complex settings preparation logic from the main plugin file.
The helper handles both single and multi-file export scenarios, ensuring consistent settings across different export contexts.
Consolidates dependency checking logic into a dedicated `DependencyChecker` class.
This improves code organization and reusability.
It now uses a single method for checking all dependencies, both asynchronously (for displaying status) and synchronously (for startup checks).
It also augments the PATH environment variable to include common binary locations to improve detection.
The status modal now displays more detailed information about each dependency.
Ensures that the format specified in the export configuration
takes precedence over the default format specified in the settings
when populating template variables for PDF conversion.
Additionally, only uses the settings default for the export format
if one is not already provided.
- Add files-menu event handler for multi-file selection in file explorer
- Create exportFiles() method for batch export with default settings
- Create showExportModalForFiles() method for batch export with configuration
- Add exportFilesWithConfig() helper for batch processing
- Update ExportConfigModalSettings to support files array
- Update modal header to show file count for multi-file exports
- Users can now select multiple files and export them all at once
- Maintains backward compatibility with single file exports
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Refines the naming and descriptions of the export commands
to better reflect their functionality and improve user
understanding. The "Export current note to PDF" command is
now "Export current note(s)", and "Export to PDF with
configuration" is now "Export with configuration…".
Refactors the export configuration modal to provide a better user experience and more accurate default values.
- Removes the batch export feature from the right-click menu.
- Updates the template variables to derive from the settings tab.
- Modifies the reset function in the export config modal to reset to plugin defaults.
- Improves font handling and font size settings in the TypographySection of the export config modal, including slider for font size.
- Enhances default template variable initialization in the ModalState.
Updates the paper size selection in settings and modals to use a predefined list of supported sizes, ensuring consistency across the plugin and compatibility with Typst.
It also maps the selected paper size to its Typst equivalent before passing it to the converter, preventing issues with unsupported sizes.
The change also ensures that template validation uses the correct paper sizes.
Updates the margin settings to directly use centimeters, removing unnecessary conversions to points.
This simplifies the configuration and improves accuracy in setting page margins for PDF exports.
The settings tab and modal now accept and display margins in centimeters.
- Import addIcon from Obsidian API
- Register custom SVG icon with 'typst-pdf-export' identifier
- Replace default 'type' icon with custom Typst logo icon
- Update SVG to include proper styling and fill color
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix font size duplication bug (11pt11pt) in exportFileWithConfig
- Fix modal settings not being respected by removing conditional fallbacks
- Fix Export Current Note to include complete template variables
- Fix PDF embed processing temp directory from system temp to plugin temp
- Fix pdf2img to use relative paths instead of absolute paths for proper file creation
- Ensure temp-images directory exists before PDF processing
The export modal now properly respects all user settings and PDF embeds
are correctly processed and found during export operations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Restore settings lost during refactor from commit 175fad5b
- Add ImageMagick path configuration with dependency checking
- Implement proper folder suggestion using AbstractInputSuggest
- Convert page format and orientation to dropdown selections
- Add template dropdown with dynamic loading from TemplateManager
- Convert font selections to dropdowns populated from `typst fonts`
- Split margins into individual top/bottom/left/right fields with CM units
- Enhance dependency checker to validate Pandoc, Typst, and ImageMagick
- Remove heading and small font size options, retain body font size only
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
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>
- 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>
- 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>
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>
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>
- 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>
- 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>