Commit Graph
80 Commits
Author SHA1 Message Date
AlexKucera ddac8bd045 Cleans up temporary directories on startup/unload
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.
2025-09-03 23:02:11 +02:00
AlexKucera 42aa8e176c Adds output path validation for enhanced security
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.
2025-09-03 22:56:30 +02:00
AlexKucera d4c4a1be73 Refactors margin input settings
Introduces a helper function to streamline the creation of margin input settings in the plugin settings tab. This improves code readability and reduces redundancy.
2025-09-03 22:46:10 +02:00
AlexKucera f4d43a7236 Refactors typography settings with helper
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.
2025-09-03 22:41:29 +02:00
AlexKucera f00bc88bb2 Improves dependency checking security
Replaces `child_process.exec` with `child_process.spawn` for both asynchronous and synchronous dependency checks.
This change mitigates potential command injection vulnerabilities by passing arguments separately, enhancing the security of the application.
2025-09-03 22:33:29 +02:00
AlexKucera fcb62d5025 Enhances font caching with process spawning
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.
2025-09-03 22:31:35 +02:00
AlexKucera 5fed127ed0 Updates gitignore
Updates the .gitignore file to exclude the repomix output file. This prevents the repomix-output.xml file from being tracked in the repository.
2025-09-03 22:28:27 +02:00
AlexKucera 3f8f2b2089 Refactors project structure for improved modularity
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.
2025-09-03 22:05:45 +02:00
AlexKucera f05ffa8bc8 Refactors project structure and PDF embedding
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.
2025-09-03 22:05:32 +02:00
AlexKucera a676f7e6c4 Refactors PDF embed logic for Typst
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.
2025-09-03 19:54:06 +02:00
AlexKucera 2bf0e57cdc Refactors PDF path resolution
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.
2025-09-03 19:52:37 +02:00
AlexKucera a2020c90f3 Introduces temp directory management
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.
2025-09-03 19:48:43 +02:00
AlexKucera f9a6166da3 Centralizes export error handling
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.
2025-09-03 19:43:52 +02:00
AlexKucera 608a51b81e Refactors export modal settings preparation
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.
2025-09-03 19:38:43 +02:00
AlexKucera d0b096368f Refactors dependency checking into a class
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.
2025-09-03 19:35:07 +02:00
AlexKucera 5fc8e348f4 Refactors fallback fonts into a constant
Moves the list of fallback fonts to a dedicated constant file.
This improves code readability and maintainability by centralizing
this configuration.
2025-09-03 19:31:19 +02:00
AlexKucera ccc0e5aec6 Delete Unused Code 2025-09-03 19:23:44 +02:00
AlexKucera 42ad862ba0 Prioritizes config format in template variables
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.
2025-09-03 19:21:13 +02:00
AlexKucera 247d5add36 Removes backup file
Removes the backup file as it's no longer needed
2025-09-03 18:16:35 +02:00
AlexKucera a8035b1b33 Removes obsolete CLAUDE.md file
Removes the CLAUDE.md file and adds it to .gitignore.

The CLAUDE.md file is no longer needed and is removed to clean up the repository.
Adding it to .gitignore prevents it from being accidentally re-added.
2025-09-03 18:15:13 +02:00
AlexKucera 856a16330e Some more gitignored files 2025-09-03 18:13:59 +02:00
AlexKucera df59486b7f Removes gitignored files
removes file that were committed but are actually in gitignore
2025-09-03 18:12:56 +02:00
AlexKucera fd23b0be4b Adds ignore rules for various files
Extends the .gitignore file to exclude various temporary files, cache directories, and project-specific files, preventing them from being tracked by Git. This helps to keep the repository clean and focused on relevant source code.
2025-09-03 18:05:22 +02:00
AlexKucera 908c7c6fe6 Add release workflow 2025-09-03 17:58:52 +02:00
AlexKucera e12fb9d40a Updates minimum Obsidian version
Updates the minimum Obsidian version required to run the plugin
to 1.9.12 and marks the plugin as desktop only.

This ensures compatibility with newer Obsidian APIs and features,
and reflects that the plugin is intended for desktop use only.
2025-09-03 17:54:08 +02:00
Jarvis fbdebc95dd feat: add multi-file export support using files-menu event
- 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>
2025-09-03 17:39:39 +02:00
AlexKucera 2f7d1feac8 Updates export command labels and descriptions
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…".
2025-09-03 17:22:20 +02:00
AlexKucera 819b127987 Improves export config modal and template vars
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.
2025-09-03 17:04:29 +02:00
Jarvis a0830e589b fix: correct unit handling for margins and font sizes in Typst export
- Add "cm" suffix to margin values (marginTop, marginBottom, marginLeft, marginRight) when passed from UI to Typst
- Add "pt" suffix to bodyFontSize values when passed from UI to Typst
- Remove obsolete heading_fontsize and small_fontsize parameters from templates
- Templates now use relative sizing (body-fontsize * multiplier) instead of separate font size variables

Fixes issue where Typst expected length units but received raw numbers, causing "expected relative length or auto, found float" errors during PDF export.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 17:02:28 +02:00
AlexKucera 05fd3d5db4 Adds .gitignore for cache directory
Prevents the cache directory from being tracked by Git,
improving repository cleanliness and reducing unnecessary
data in the repository.
2025-09-03 16:57:01 +02:00
AlexKucera 8678e110b9 Standardizes heading font size calculation
Removes configurable heading and small font sizes, and calculates the heading font size based on the body font size to ensure consistency across templates.
2025-09-03 16:56:53 +02:00
AlexKucera 26ddbb7f35 Enhances paper size selection and handling
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.
2025-09-03 14:35:34 +02:00
AlexKucera c749852125 Simplifies margin handling to use centimeters
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.
2025-09-03 13:59:35 +02:00
AlexKucera 4b4f0e55ed Uses page-margin variable for page margins
Replaces hardcoded page margin values with the `page-margin`
variable in the default and modern templates. This promotes
consistency and makes it easier to adjust margins globally.
2025-09-03 11:37:09 +02:00
AlexKucera 51f16f3c23 Refactors report template for enhanced layout
Improves the report template's visual structure by reorganizing the title page elements and removing redundant heading counters.

The title page layout is enhanced for better readability and visual appeal. Heading counters were removed from the body as they were redundant. Adds table of contents outline.
2025-09-03 11:32:07 +02:00
AlexKucera fca8f8104d Simplifies font stacks in templates
Refines font configurations in article and modern templates.
Removes redundant "serif" and "sans-serif" generic families from the font stacks.
This change results in cleaner and more efficient font declarations.
2025-09-03 11:23:52 +02:00
AlexKucera 974fe8d7e7 Changes the typst2pdf icon to grey 2025-09-03 11:02:07 +02:00
Jarvis ec4dc1d77c feat: add custom Typst icon to ribbon
- 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>
2025-09-03 10:59:31 +02:00
Jarvis 305df30c85 fix: replace invalid orientation parameter with flipped in Typst templates
- Replace orientation: orientation with flipped: orientation == "landscape"
- Add conditional width: auto for single-page landscape exports
- Ensure all templates use correct Typst page() parameters
- Fix compilation errors in modern, article, report, and default templates

Resolves Typst compilation error: "unexpected argument: orientation"

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 10:49:19 +02:00
AlexKucera 9039b90bb5 Removes font cache
Deletes the fonts-cache.json file and adds it to .gitignore.

This ensures that font cache is not tracked in the repository.
2025-09-03 10:47:21 +02:00
AlexKucera 6eedeaace3 Adds export configuration modal sections
Adds sections to the export configuration modal for behavior, page setup, and typography.

These sections allow users to configure export behavior like opening the PDF after export and preserving folder structure, as well as page setup options like page size, orientation, and margins.
Additionally, typography options for font selection and size configuration are included.
Updates default settings for export format and adds default values for new settings.

Removes the old TypographySection file.
2025-09-03 10:16:48 +02:00
AlexKucera 2bec4963b3 Adds initial fonts cache
Adds a JSON file containing a list of font names, a timestamp, and the path to the Typst executable.

This file serves as a cache for available fonts.
2025-09-03 10:16:25 +02:00
AlexKucera 0e89488cf7 Adds folder path autocompletion
Implements a folder suggestion component that provides
autocomplete for existing vault folders in folder path inputs.

This enhances the user experience by making it easier to select
existing folders when specifying file paths.
2025-09-03 10:16:11 +02:00
AlexKucera 346268cd68 Removes unused image files
Deletes several preview images from the repository that are no longer needed.

These images were likely temporary files and are now obsolete.
2025-09-03 10:16:01 +02:00
AlexKucera 16486468d4 Adds a new application icon
Introduces a new SVG icon for the application, enhancing its visual representation.
Includes the corresponding icon design file.
2025-09-03 10:15:54 +02:00
AlexKucera 628b7881c4 Updates ribbon icon to 'type'
Changes the ribbon icon from 'download' to 'type', offering a better visual cue for the Typst export functionality.
2025-09-03 10:15:31 +02:00
Jarvis 99da5f6cee fix: resolve export modal and PDF embed processing issues
- 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>
2025-09-03 10:15:19 +02:00
Jarvis 1a676ce375 feat(settings): restore lost settings and enhance plugin configuration
- 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>
2025-09-02 18:13:47 +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
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