Fixes path, image, and bibliography issues #7

Merged
AlexKucera merged 19 commits from windows_path_fix into master 2025-11-05 09:28:22 +01:00
AlexKucera commented 2025-11-04 10:58:03 +01:00 (Migrated from github.com)

Addresses several issues related to file paths, remote images, and bibliography generation:

  • Resolves issues with absolute path handling on Windows
  • Enables support for remote images in markdown files
  • Prevents errors related to missing bibliographies by disabling Pandoc's automatic citeproc filter. This avoids Pandoc incorrectly detecting citation patterns and attempting to generate a bibliography when none is provided.

Summary by CodeRabbit

  • New Features

    • Remote image download/embedding with timeout, temp storage/cleanup; direct Markdown→PDF and PDF→image conversion flows; single-page export option.
  • Bug Fixes

    • Improved Windows/path handling, remote URL image resilience, bibliography/citation behavior, and stricter path/executable validation.
  • Refactor

    • Centralized path, temp-directory, resource and command-building logic; unified resolution and lifecycle/cleanup handling.
  • Documentation

    • Expanded changelog, diagnostics, and user-facing notices.
  • Tests

    • Comprehensive unit tests and test harness added.
Addresses several issues related to file paths, remote images, and bibliography generation: - Resolves issues with absolute path handling on Windows - Enables support for remote images in markdown files - Prevents errors related to missing bibliographies by disabling Pandoc's automatic citeproc filter. This avoids Pandoc incorrectly detecting citation patterns and attempting to generate a bibliography when none is provided. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Remote image download/embedding with timeout, temp storage/cleanup; direct Markdown→PDF and PDF→image conversion flows; single-page export option. * **Bug Fixes** * Improved Windows/path handling, remote URL image resilience, bibliography/citation behavior, and stricter path/executable validation. * **Refactor** * Centralized path, temp-directory, resource and command-building logic; unified resolution and lifecycle/cleanup handling. * **Documentation** * Expanded changelog, diagnostics, and user-facing notices. * **Tests** * Comprehensive unit tests and test harness added. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2025-11-04 10:58:22 +01:00 (Migrated from github.com)

Walkthrough

Adds remote-image detection and download queuing, centralizes vault/path/temp utilities, introduces a Pandoc command builder and richer conversion lifecycle, strengthens dependency and security checks, expands settings and modal helpers, adds PDF→image pipeline, extensive unit tests and Vitest infra, and updates changelog and gitignore.

Changes

Cohort / File(s) Summary
Core path, temp & constants
src/core/PathUtils.ts, src/core/TempDirectoryManager.ts, src/core/constants.ts
Add PathUtils for normalized path operations, TempDirectoryManager for plugin-scoped temp dirs and cleanup, extend constants (FONTS_CACHE, NOTICE_DURATION) and expand FALLBACK_FONTS.
Markdown preprocessing
src/converters/MarkdownPreprocessor.ts
Rework preprocessor pipeline: new metadata structure, detect/queue standard Markdown remote images into metadata.imageEmbeds, replace with IMAGE_EMBED_MARKER, add options (baseUrl, printFrontmatter) and richer PreprocessingResult.
Embed handling & remote downloads
src/plugin/EmbedProcessor.ts
Add resolveLocalPath and downloadRemoteImage; unify local-resolution and remote-download logic (redirects, timeouts, temp storage, fallbacks) for image/embed processing.
Pandoc command & conversion flow
src/converters/pandoc/PandocCommandBuilder.ts, src/converters/PandocTypstConverter.ts, src/converters/pandoc/PandocExecutor.ts
New PandocCommandBuilder to assemble pandoc args (Typst integration, resource paths, templates, engine opts); PandocTypstConverter adds temp-dir lifecycle, convertMarkdownToPDF, cleanup and progress callbacks; PandocExecutor docs expanded.
PDF → image conversion
src/converters/PdfToImageConverter.ts, src/converters/pdf/BinaryLocator.ts
Add PdfToImageConverter singleton API (convert/validate/getInfo), structured conversion pipeline; BinaryLocator refactors to reuse PathUtils and refines Windows path handling.
Dependency & executable checks
src/core/ExecutableChecker.ts, src/core/DependencyChecker.ts
Add DependencyInfo/DependencyCheckResult, PATH/env augmentation helpers, async/sync executable resolution and version checks, status reporting and showDependencyStatus.
Security & error handling
src/core/SecurityUtils.ts, src/core/ExportErrorHandler.ts
Add strict output/executable path validation with detailed error messages; introduce ExportErrorHandler with structured batch/single error types and multiple user-notice helpers.
Settings & modal helpers
src/core/settings.ts, src/core/ModalSettingsHelper.ts
Expand settings schema (paths, executables, typography, pageSetup, behavior), add ExportFormat enum, and ModalSettingsHelper static helpers for single/multi-file modal preparation.
Tests, mocks & test infra
tests/*, tests/__mocks__/obsidian.ts, vitest.config.ts, package.json, .gitignore
Add many unit tests (ModalSettingsHelper, SecurityUtils, TempDirectoryManager, TypstVariableMapper, paperSizeMapper, basicCoverage, converterTypes), Obsidian mock, Vitest config and scripts, dev-deps, and add coverage/ to .gitignore.
Changelog & misc
CHANGELOG.md, package.json
Update CHANGELOG (Unreleased and historical items), add test scripts/dev-deps in package.json.

Sequence Diagram(s)

sequenceDiagram
    participant MD as MarkdownPreprocessor
    participant Meta as ResultMetadata
    participant EP as EmbedProcessor
    participant DL as RemoteDownloader
    participant FS as Filesystem
    participant CMD as PandocCommandBuilder
    participant PAND as PandocExecutor

    MD->>MD: scan content for images
    alt remote (http/https)
        MD->>Meta: queue imageEmbeds {originalPath, sanitizedPath, fileName, marker}
        MD->>MD: replace image with IMAGE_EMBED_MARKER
    else local
        MD->>MD: keep local markup (handle embeds/wikilinks)
    end

    EP->>Meta: read imageEmbeds
    loop each embed
        EP->>EP: isRemote?
        alt yes
            EP->>DL: downloadRemoteImage(url, tempDir)
            DL->>FS: HTTP(S) request (redirects, timeout)
            FS-->>DL: localTempPath / error
            DL-->>EP: downloadedPath or null
            EP->>EP: replace marker with local path or placeholder
        else no
            EP->>EP: resolveLocalPath(decodedPath, vaultBase, currentFile, additionalPaths)
            EP->>EP: replace marker with resolved vault path or placeholder
        end
    end

    CMD->>CMD: buildPandocArgs(input, output, pandocOptions)
    CMD-->>PAND: args[]
    PAND->>FS: spawn pandoc with args (engine, resources, template)
    PAND-->>PAND: parse progress & errors

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

  • Areas needing extra attention:
    • src/plugin/EmbedProcessor.ts — HTTP(S) edge cases, temp-file naming/cleanup, sanitization.
    • src/core/PathUtils.ts & src/core/TempDirectoryManager.ts — vault-relative vs absolute semantics and Windows drive/UNC handling.
    • src/converters/pandoc/PandocCommandBuilder.ts — template discovery, resource-path ordering, variable mapping.
    • src/core/ExecutableChecker.ts & src/core/DependencyChecker.ts — PATH augmentation, version parsing, concurrency and async error paths.

Possibly related PRs

Poem

🐰
I hop through markdown, fetching images from afar,
I stitch vault paths and tidy temp files in my jar,
I build commands, map variables, and guard each route,
I warn, I test, I clean — a rabbit's quiet bout,
Petite refactor, neat and bright. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fixes path, image, and bibliography issues' directly corresponds to the three main objectives stated in the PR description: path handling on Windows, remote image support, and bibliography/citeproc fixes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch windows_path_fix

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35a5249607 and 68238e3db2.

📒 Files selected for processing (4)
  • src/core/ExecutableChecker.ts (7 hunks)
  • src/core/SecurityUtils.ts (6 hunks)
  • src/core/TempDirectoryManager.ts (6 hunks)
  • src/plugin/PathResolver.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts
Add user-facing commands via this.addCommand(...) and use stable command IDs
Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab
Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload
Prefer async/await over promise chains and handle errors gracefully

Files:

  • src/plugin/PathResolver.ts
  • src/core/SecurityUtils.ts
  • src/core/TempDirectoryManager.ts
  • src/core/ExecutableChecker.ts
🧠 Learnings (1)
📚 Learning: 2025-09-25T14:27:31.837Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/core/PathUtils.ts:108-119
Timestamp: 2025-09-25T14:27:31.837Z
Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations.

Applied to files:

  • src/core/TempDirectoryManager.ts
  • src/core/ExecutableChecker.ts
🧬 Code graph analysis (2)
src/core/TempDirectoryManager.ts (2)
tests/__mocks__/obsidian.ts (2)
  • App (54-65)
  • normalizePath (47-49)
src/core/constants.ts (1)
  • PLUGIN_DIRS (89-93)
src/core/ExecutableChecker.ts (1)
src/core/constants.ts (1)
  • DEPENDENCY_CONSTANTS (187-252)
🔇 Additional comments (2)
src/core/TempDirectoryManager.ts (2)

26-26: Verify the use of Node.js path module aligns with the updated approach.

The code imports and uses the Node.js path module for path joining operations. This deviates from a previous learning that the plugin prefers Obsidian API calls over Node.js built-in modules for path operations. However, given that this PR explicitly aims to fix Windows path handling issues and path.join is used to properly handle absolute paths cross-platform (as noted in the comments), this appears to be an intentional architectural decision.

Please confirm that using path.join is the intended approach going forward, as it provides more robust cross-platform path handling than string concatenation or alternatives.

Based on learnings.

Also applies to: 169-169, 208-208, 446-447


117-458: Excellent implementation of the temp directory manager.

The implementation is well-structured with proper:

  • Async/await patterns throughout
  • Error handling (creation errors propagate, cleanup errors are caught and logged)
  • Security validation in isPluginTempDir with correct path prefix checking
  • Comprehensive JSDoc documentation
  • Type safety with TypeScript interfaces
  • Cross-platform compatibility

The design choices are sound:

  • Cleanup preserves directory structure (removes files only)
  • Non-throwing cleanup allows exports to complete even if cleanup fails
  • Factory method provides convenient instantiation
  • Path validation prevents directory traversal attacks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough Adds remote-image detection and download queuing, centralizes vault/path/temp utilities, introduces a Pandoc command builder and richer conversion lifecycle, strengthens dependency and security checks, expands settings and modal helpers, adds PDF→image pipeline, extensive unit tests and Vitest infra, and updates changelog and gitignore. ## Changes | Cohort / File(s) | Summary | |---|---| | **Core path, temp & constants** <br> `src/core/PathUtils.ts`, `src/core/TempDirectoryManager.ts`, `src/core/constants.ts` | Add `PathUtils` for normalized path operations, `TempDirectoryManager` for plugin-scoped temp dirs and cleanup, extend constants (`FONTS_CACHE`, `NOTICE_DURATION`) and expand `FALLBACK_FONTS`. | | **Markdown preprocessing** <br> `src/converters/MarkdownPreprocessor.ts` | Rework preprocessor pipeline: new metadata structure, detect/queue standard Markdown remote images into `metadata.imageEmbeds`, replace with IMAGE_EMBED_MARKER, add options (`baseUrl`, `printFrontmatter`) and richer PreprocessingResult. | | **Embed handling & remote downloads** <br> `src/plugin/EmbedProcessor.ts` | Add `resolveLocalPath` and `downloadRemoteImage`; unify local-resolution and remote-download logic (redirects, timeouts, temp storage, fallbacks) for image/embed processing. | | **Pandoc command & conversion flow** <br> `src/converters/pandoc/PandocCommandBuilder.ts`, `src/converters/PandocTypstConverter.ts`, `src/converters/pandoc/PandocExecutor.ts` | New `PandocCommandBuilder` to assemble pandoc args (Typst integration, resource paths, templates, engine opts); `PandocTypstConverter` adds temp-dir lifecycle, `convertMarkdownToPDF`, cleanup and progress callbacks; `PandocExecutor` docs expanded. | | **PDF → image conversion** <br> `src/converters/PdfToImageConverter.ts`, `src/converters/pdf/BinaryLocator.ts` | Add `PdfToImageConverter` singleton API (convert/validate/getInfo), structured conversion pipeline; `BinaryLocator` refactors to reuse `PathUtils` and refines Windows path handling. | | **Dependency & executable checks** <br> `src/core/ExecutableChecker.ts`, `src/core/DependencyChecker.ts` | Add `DependencyInfo`/`DependencyCheckResult`, PATH/env augmentation helpers, async/sync executable resolution and version checks, status reporting and `showDependencyStatus`. | | **Security & error handling** <br> `src/core/SecurityUtils.ts`, `src/core/ExportErrorHandler.ts` | Add strict output/executable path validation with detailed error messages; introduce `ExportErrorHandler` with structured batch/single error types and multiple user-notice helpers. | | **Settings & modal helpers** <br> `src/core/settings.ts`, `src/core/ModalSettingsHelper.ts` | Expand settings schema (paths, executables, typography, pageSetup, behavior), add `ExportFormat` enum, and `ModalSettingsHelper` static helpers for single/multi-file modal preparation. | | **Tests, mocks & test infra** <br> `tests/*`, `tests/__mocks__/obsidian.ts`, `vitest.config.ts`, `package.json`, `.gitignore` | Add many unit tests (ModalSettingsHelper, SecurityUtils, TempDirectoryManager, TypstVariableMapper, paperSizeMapper, basicCoverage, converterTypes), Obsidian mock, Vitest config and scripts, dev-deps, and add `coverage/` to `.gitignore`. | | **Changelog & misc** <br> `CHANGELOG.md`, `package.json` | Update CHANGELOG (Unreleased and historical items), add test scripts/dev-deps in `package.json`. | ## Sequence Diagram(s) ```mermaid sequenceDiagram participant MD as MarkdownPreprocessor participant Meta as ResultMetadata participant EP as EmbedProcessor participant DL as RemoteDownloader participant FS as Filesystem participant CMD as PandocCommandBuilder participant PAND as PandocExecutor MD->>MD: scan content for images alt remote (http/https) MD->>Meta: queue imageEmbeds {originalPath, sanitizedPath, fileName, marker} MD->>MD: replace image with IMAGE_EMBED_MARKER else local MD->>MD: keep local markup (handle embeds/wikilinks) end EP->>Meta: read imageEmbeds loop each embed EP->>EP: isRemote? alt yes EP->>DL: downloadRemoteImage(url, tempDir) DL->>FS: HTTP(S) request (redirects, timeout) FS-->>DL: localTempPath / error DL-->>EP: downloadedPath or null EP->>EP: replace marker with local path or placeholder else no EP->>EP: resolveLocalPath(decodedPath, vaultBase, currentFile, additionalPaths) EP->>EP: replace marker with resolved vault path or placeholder end end CMD->>CMD: buildPandocArgs(input, output, pandocOptions) CMD-->>PAND: args[] PAND->>FS: spawn pandoc with args (engine, resources, template) PAND-->>PAND: parse progress & errors ``` ## Estimated code review effort 🎯 4 (Complex) | ⏱️ ~50 minutes - Areas needing extra attention: - src/plugin/EmbedProcessor.ts — HTTP(S) edge cases, temp-file naming/cleanup, sanitization. - src/core/PathUtils.ts & src/core/TempDirectoryManager.ts — vault-relative vs absolute semantics and Windows drive/UNC handling. - src/converters/pandoc/PandocCommandBuilder.ts — template discovery, resource-path ordering, variable mapping. - src/core/ExecutableChecker.ts & src/core/DependencyChecker.ts — PATH augmentation, version parsing, concurrency and async error paths. ## Possibly related PRs - AlexKucera/obsidian-typst-pdf-export#5 — Overlaps on PathUtils/TempDirectoryManager centralization and related updates to EmbedProcessor, BinaryLocator, and temp-dir handling. ## Poem > 🐰 > I hop through markdown, fetching images from afar, > I stitch vault paths and tidy temp files in my jar, > I build commands, map variables, and guard each route, > I warn, I test, I clean — a rabbit's quiet bout, > Petite refactor, neat and bright. 🥕 <!-- walkthrough_end --> <!-- pre_merge_checks_walkthrough_start --> ## Pre-merge checks and finishing touches <details> <summary>✅ Passed checks (2 passed)</summary> | Check name | Status | Explanation | | :---------------: | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. | | Title check | ✅ Passed | The title 'Fixes path, image, and bibliography issues' directly corresponds to the three main objectives stated in the PR description: path handling on Windows, remote image support, and bibliography/citeproc fixes. | </details> <!-- pre_merge_checks_walkthrough_end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing touches</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate docstrings <details> <summary>🧪 Generate unit tests (beta)</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests - [ ] <!-- {"checkboxId": "07f1e7d6-8a8e-4e23-9900-8731c2c87f58", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Post copyable unit tests in a comment - [ ] <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Commit unit tests in branch `windows_path_fix` </details> </details> <!-- finishing_touch_checkbox_end --> --- <details> <summary>📜 Recent review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 35a5249607720ad86047bd14021a9833f5777318 and 68238e3db229ac472ee006e942624cfb7802dbdd. </details> <details> <summary>📒 Files selected for processing (4)</summary> * `src/core/ExecutableChecker.ts` (7 hunks) * `src/core/SecurityUtils.ts` (6 hunks) * `src/core/TempDirectoryManager.ts` (6 hunks) * `src/plugin/PathResolver.ts` (1 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (1)</summary> <details> <summary>src/**/*.ts</summary> **📄 CodeRabbit inference engine (AGENTS.md)** > `src/**/*.ts`: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts > Add user-facing commands via this.addCommand(...) and use stable command IDs > Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab > Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload > Prefer async/await over promise chains and handle errors gracefully Files: - `src/plugin/PathResolver.ts` - `src/core/SecurityUtils.ts` - `src/core/TempDirectoryManager.ts` - `src/core/ExecutableChecker.ts` </details> </details><details> <summary>🧠 Learnings (1)</summary> <details> <summary>📚 Learning: 2025-09-25T14:27:31.837Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/core/PathUtils.ts:108-119 Timestamp: 2025-09-25T14:27:31.837Z Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations. ``` **Applied to files:** - `src/core/TempDirectoryManager.ts` - `src/core/ExecutableChecker.ts` </details> </details><details> <summary>🧬 Code graph analysis (2)</summary> <details> <summary>src/core/TempDirectoryManager.ts (2)</summary><blockquote> <details> <summary>tests/__mocks__/obsidian.ts (2)</summary> * `App` (54-65) * `normalizePath` (47-49) </details> <details> <summary>src/core/constants.ts (1)</summary> * `PLUGIN_DIRS` (89-93) </details> </blockquote></details> <details> <summary>src/core/ExecutableChecker.ts (1)</summary><blockquote> <details> <summary>src/core/constants.ts (1)</summary> * `DEPENDENCY_CONSTANTS` (187-252) </details> </blockquote></details> </details> </details> <details> <summary>🔇 Additional comments (2)</summary><blockquote> <details> <summary>src/core/TempDirectoryManager.ts (2)</summary><blockquote> `26-26`: **Verify the use of Node.js `path` module aligns with the updated approach.** The code imports and uses the Node.js `path` module for path joining operations. This deviates from a previous learning that the plugin prefers Obsidian API calls over Node.js built-in modules for path operations. However, given that this PR explicitly aims to fix Windows path handling issues and `path.join` is used to properly handle absolute paths cross-platform (as noted in the comments), this appears to be an intentional architectural decision. Please confirm that using `path.join` is the intended approach going forward, as it provides more robust cross-platform path handling than string concatenation or alternatives. Based on learnings. Also applies to: 169-169, 208-208, 446-447 --- `117-458`: **Excellent implementation of the temp directory manager.** The implementation is well-structured with proper: - Async/await patterns throughout - Error handling (creation errors propagate, cleanup errors are caught and logged) - Security validation in `isPluginTempDir` with correct path prefix checking - Comprehensive JSDoc documentation - Type safety with TypeScript interfaces - Cross-platform compatibility The design choices are sound: - Cleanup preserves directory structure (removes files only) - Non-throwing cleanup allows exports to complete even if cleanup fails - Factory method provides convenient instantiation - Path validation prevents directory traversal attacks </blockquote></details> </blockquote></details> </details> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=AlexKucera/obsidian-typst-pdf-export&utm_content=7)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub> <!-- tips_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAYvAAe0jzUsAA0KMxopOGY9GoCHvD4RFTcsPJIDkGQBgByjgKUXADskDkAqjYAMlywuLjciBwA9M1E6rDYAhpMzM0Agl7+ANLYDMrNgojwtPCYYLiyjbhg3LQAZmAk/tz4FLjN3NgeHs2lFYhFkIPbo+NUZQYAyvjYFOOQAlQYDLBcAO7wDC0fD/RAAfW4IXB6wCkEASYQwZykXCfb6/LiRRA0Pg5J64ajYJr8bhkR42EgSeAkf6UYkYfDkSCJbF0R5VFQkDz0xkkZlIGj0HIAYQoJGobOoXAATAAGaUAVjAAEZlWBZQAWaCygCcHAVAA4OLKAMwALSMABFpAwKPBuOJGRwDFAKYh8B4pMhMtggoDcLB0AJ3R48HyoQHILBYokMER+FgAOpAkFgjQuyAAUQwKi8yAc3F2+0g6z2kDFzHwNAiUSCYvWlDI43oQMgAFlnABrVNYWF59NQKxiqQYXDISgUPbIdaT5iQZiZIHx+KJZKpBB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BGQt5+WdlCALa81VbIF395GQ0eNYI8eR5682IVrUK5jwikxrucwXigohfVQ85EUXZw0F6j55n8nteenQMFw+dqiKF681GjUJMeCZonKtm61g0DQRCrg7E0yWf1YEh/wlWF26wbn19QmQh30Teq2Cch4EKIgOSj/asS2AXWeOdOgxvNJI2HVRWCBAzZ2HvKRxTF4RBjNXmHeACo8KKCgEXMPkZDgXy51BegX1UBdFB1YoLWeJCJl7BeQt8F4efZ4y59rheAqF7sK4+ZQA2q5na57YAnnlF9VDSgIpzCf/HAgLCeygxx3HAMAxQMqDrADAPcdoAxQLSe4nIpxsCygBoKicbAGoEie0AxQEScKgBAjqCyg3J3Kf0tqoMqDBXtALKB6XPzavC7UqVcITLnqJ86dSnJAOycwnxQDKfKgmoHyf7H6wGid/HSgBqBcn1J2gBcnSdWgBygBoLQARXdx/FcKgfx1FcfHyoHKcunxQLQCuY1OaGdig4Zzl7ggUZ8Gf6AQAA=== --> <!-- internal state end -->
AlexKucera commented 2025-11-04 10:59:02 +01:00 (Migrated from github.com)

@coderabbitai configuration

@coderabbitai configuration
coderabbitai[bot] commented 2025-11-04 10:59:20 +01:00 (Migrated from github.com)
CodeRabbit configuration
language: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
reviews:
  profile: chill
  request_changes_workflow: false
  high_level_summary: true
  high_level_summary_placeholder: '@coderabbitai summary'
  high_level_summary_in_walkthrough: false
  auto_title_placeholder: '@coderabbitai'
  auto_title_instructions: ''
  review_status: true
  commit_status: true
  fail_commit_status: false
  collapse_walkthrough: false
  changed_files_summary: true
  sequence_diagrams: true
  estimate_code_review_effort: true
  assess_linked_issues: true
  related_issues: true
  related_prs: true
  suggested_labels: true
  labeling_instructions: []
  auto_apply_labels: false
  suggested_reviewers: true
  auto_assign_reviewers: false
  in_progress_fortune: true
  poem: true
  path_filters: []
  path_instructions: []
  abort_on_close: true
  disable_cache: false
  auto_review:
    enabled: true
    auto_incremental_review: true
    ignore_title_keywords: []
    labels: []
    drafts: false
    base_branches: []
    ignore_usernames: []
  finishing_touches:
    docstrings:
      enabled: true
    unit_tests:
      enabled: true
  pre_merge_checks:
    docstrings:
      mode: warning
      threshold: 80
    title:
      mode: warning
      requirements: ''
    description:
      mode: warning
    issue_assessment:
      mode: warning
    custom_checks: []
  tools:
    ast-grep:
      rule_dirs: []
      util_dirs: []
      essential_rules: true
      packages: []
    shellcheck:
      enabled: true
    ruff:
      enabled: true
    markdownlint:
      enabled: true
    github-checks:
      enabled: true
      timeout_ms: 90000
    languagetool:
      enabled: true
      enabled_rules: []
      disabled_rules: []
      enabled_categories: []
      disabled_categories: []
      enabled_only: false
      level: default
    biome:
      enabled: true
    hadolint:
      enabled: true
    swiftlint:
      enabled: true
    phpstan:
      enabled: true
      level: default
    phpmd:
      enabled: true
    phpcs:
      enabled: true
    golangci-lint:
      enabled: true
    yamllint:
      enabled: true
    gitleaks:
      enabled: true
    checkov:
      enabled: true
    detekt:
      enabled: true
    eslint:
      enabled: true
    flake8:
      enabled: true
    rubocop:
      enabled: true
    buf:
      enabled: true
    regal:
      enabled: true
    actionlint:
      enabled: true
    pmd:
      enabled: true
    clang:
      enabled: true
    cppcheck:
      enabled: true
    semgrep:
      enabled: true
    circleci:
      enabled: true
    clippy:
      enabled: true
    sqlfluff:
      enabled: true
    prismaLint:
      enabled: true
    pylint:
      enabled: true
    oxc:
      enabled: true
    shopifyThemeCheck:
      enabled: true
    luacheck:
      enabled: true
    brakeman:
      enabled: true
    dotenvLint:
      enabled: true
    htmlhint:
      enabled: true
    checkmake:
      enabled: true
    osvScanner:
      enabled: true
chat:
  art: true
  auto_reply: true
  integrations:
    jira:
      usage: auto
    linear:
      usage: auto
knowledge_base:
  opt_out: false
  web_search:
    enabled: true
  code_guidelines:
    enabled: true
    filePatterns: []
  learnings:
    scope: auto
  issues:
    scope: auto
  jira:
    usage: auto
    project_keys: []
  linear:
    usage: auto
    team_keys: []
  pull_requests:
    scope: auto
  mcp:
    usage: auto
    disabled_servers: []
code_generation:
  docstrings:
    language: en-US
    path_instructions: []
  unit_tests:
    path_instructions: []

<!-- This is an auto-generated reply by CodeRabbit --> <details> <summary>CodeRabbit configuration</summary> ```yaml language: en-US tone_instructions: '' early_access: false enable_free_tier: true reviews: profile: chill request_changes_workflow: false high_level_summary: true high_level_summary_placeholder: '@coderabbitai summary' high_level_summary_in_walkthrough: false auto_title_placeholder: '@coderabbitai' auto_title_instructions: '' review_status: true commit_status: true fail_commit_status: false collapse_walkthrough: false changed_files_summary: true sequence_diagrams: true estimate_code_review_effort: true assess_linked_issues: true related_issues: true related_prs: true suggested_labels: true labeling_instructions: [] auto_apply_labels: false suggested_reviewers: true auto_assign_reviewers: false in_progress_fortune: true poem: true path_filters: [] path_instructions: [] abort_on_close: true disable_cache: false auto_review: enabled: true auto_incremental_review: true ignore_title_keywords: [] labels: [] drafts: false base_branches: [] ignore_usernames: [] finishing_touches: docstrings: enabled: true unit_tests: enabled: true pre_merge_checks: docstrings: mode: warning threshold: 80 title: mode: warning requirements: '' description: mode: warning issue_assessment: mode: warning custom_checks: [] tools: ast-grep: rule_dirs: [] util_dirs: [] essential_rules: true packages: [] shellcheck: enabled: true ruff: enabled: true markdownlint: enabled: true github-checks: enabled: true timeout_ms: 90000 languagetool: enabled: true enabled_rules: [] disabled_rules: [] enabled_categories: [] disabled_categories: [] enabled_only: false level: default biome: enabled: true hadolint: enabled: true swiftlint: enabled: true phpstan: enabled: true level: default phpmd: enabled: true phpcs: enabled: true golangci-lint: enabled: true yamllint: enabled: true gitleaks: enabled: true checkov: enabled: true detekt: enabled: true eslint: enabled: true flake8: enabled: true rubocop: enabled: true buf: enabled: true regal: enabled: true actionlint: enabled: true pmd: enabled: true clang: enabled: true cppcheck: enabled: true semgrep: enabled: true circleci: enabled: true clippy: enabled: true sqlfluff: enabled: true prismaLint: enabled: true pylint: enabled: true oxc: enabled: true shopifyThemeCheck: enabled: true luacheck: enabled: true brakeman: enabled: true dotenvLint: enabled: true htmlhint: enabled: true checkmake: enabled: true osvScanner: enabled: true chat: art: true auto_reply: true integrations: jira: usage: auto linear: usage: auto knowledge_base: opt_out: false web_search: enabled: true code_guidelines: enabled: true filePatterns: [] learnings: scope: auto issues: scope: auto jira: usage: auto project_keys: [] linear: usage: auto team_keys: [] pull_requests: scope: auto mcp: usage: auto disabled_servers: [] code_generation: docstrings: language: en-US path_instructions: [] unit_tests: path_instructions: [] ``` </details>
coderabbitai[bot] (Migrated from github.com) reviewed 2025-11-04 11:02:17 +01:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 1

🧹 Nitpick comments (6)
src/core/TempDirectoryManager.ts (2)

37-58: Simplify path construction logic.

The manual iteration through segments to handle absolute paths replicates behavior already provided by path.join(). Node.js path.join() automatically handles absolute path segments by resetting the base when an absolute path is encountered.

Apply this diff to simplify:

-	private getPluginDir(): string {
-		// Use path.join to properly handle absolute paths
-		const segments = [this.vaultPath, this.configDir, 'plugins', this.pluginName];
-		let result = '';
-
-		for (const segment of segments) {
-			if (!segment) continue;
-
-			if (path.isAbsolute(segment)) {
-				// This segment is absolute, use it as the new base
-				result = segment;
-			} else if (result) {
-				// Join with the current result
-				result = path.join(result, segment);
-			} else {
-				// First relative segment
-				result = segment;
-			}
-		}
-
-		return normalizePath(path.normalize(result));
+	private getPluginDir(): string {
+		// path.join automatically handles absolute paths correctly
+		const result = path.join(this.vaultPath, this.configDir, 'plugins', this.pluginName);
+		return normalizePath(result);
 	}

133-144: Remove redundant path.normalize calls.

The paths are already normalized by normalizePath() and passed through path.join(), making the additional path.normalize() calls redundant.

Apply this diff:

 	public isPluginTempDir(dirPath: string): boolean {
 		const pluginDir = this.getPluginDir();
 		const normalizedDirPath = normalizePath(dirPath);
 		const normalizedPluginDir = normalizePath(pluginDir);
-
-		// Use path.join to properly handle absolute paths
-		const tempImagesDir = normalizePath(path.normalize(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_IMAGES)));
-		const tempPandocDir = normalizePath(path.normalize(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_PANDOC)));
+		const tempImagesDir = normalizePath(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_IMAGES));
+		const tempPandocDir = normalizePath(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_PANDOC));

 		return normalizedDirPath.startsWith(tempImagesDir) ||
 		       normalizedDirPath.startsWith(tempPandocDir);
 	}
src/core/PathUtils.ts (1)

34-62: Simplify path joining logic.

The manual iteration to handle absolute paths replicates behavior already provided by path.join(). Node.js path.join() automatically handles absolute path segments correctly across platforms.

Apply this diff to simplify:

 	joinPath(...segments: string[]): string {
-		// Filter out empty segments
 		const filtered = segments.filter(s => s);
-
 		if (filtered.length === 0) {
 			return '';
 		}
-
-		// Find the last absolute path in the segments
-		// If a segment is absolute, it becomes the new base and we ignore previous segments
-		let result = '';
-		for (const segment of filtered) {
-			if (path.isAbsolute(segment)) {
-				// This segment is absolute, use it as the new base
-				result = segment;
-			} else if (result) {
-				// Join with the current result
-				result = path.join(result, segment);
-			} else {
-				// First relative segment
-				result = segment;
-			}
-		}
-
-		// Normalize the final path using path.normalize for cross-platform compatibility
-		// then use Obsidian's normalizePath for vault-relative paths
-		const normalized = path.normalize(result);
-		return normalizePath(normalized);
+		const result = path.join(...filtered);
+		return normalizePath(result);
 	}

Note: path.join() already normalizes paths and handles absolute segments by using the last absolute path as the new base.

src/plugin/EmbedProcessor.ts (2)

27-104: Consider using Obsidian's vault.adapter for file operations.

The implementation uses Node.js fs module directly (lines 69, 82) to write downloaded images, bypassing Obsidian's vault.adapter API. This is inconsistent with the codebase's preference for Obsidian APIs.

Additionally, there's no check if a file already exists at outputPath before writing, which could overwrite existing files or cause concurrent write issues.

Consider:

  1. Using this.plugin.app.vault.adapter.writeBinary() instead of fs.createWriteStream()
  2. Checking file existence before writing to avoid overwriting

Example approach:

// Check if file exists
const exists = await this.pathUtils.fileExists(outputPath);
if (exists) {
    // Handle collision: append timestamp or skip
}

// Write using vault adapter
const chunks: Buffer[] = [];
response.on('data', (chunk) => chunks.push(chunk));
response.on('end', async () => {
    try {
        const buffer = Buffer.concat(chunks);
        await this.plugin.app.vault.adapter.writeBinary(outputPath, buffer);
        resolve(outputPath);
    } catch (err) {
        console.error(`Export: Error writing image: ${err.message}`);
        resolve(null);
    }
});

226-248: Consolidate duplicate path resolution logic.

The local file path resolution logic (lines 227-247) duplicates similar logic in resolvePdfPath() and resolveFilePath() methods. Consider extracting this into a shared helper method.

Example:

private async resolveLocalPath(
    decodedPath: string,
    vaultBasePath: string,
    currentFile?: TFile,
    additionalPaths: string[] = []
): Promise<string | null> {
    const possiblePaths = [
        path.resolve(vaultBasePath, decodedPath),
        currentFile ? path.resolve(vaultBasePath, path.dirname(currentFile.path), decodedPath) : null,
        ...additionalPaths
    ].filter((p): p is string => p !== null);

    for (const possiblePath of possiblePaths) {
        try {
            if (await this.pathUtils.fileExists(possiblePath)) {
                return possiblePath;
            }
        } catch {
            // Continue to next path
        }
    }
    return null;
}

Then call it from processImageEmbeds, resolvePdfPath, and resolveFilePath.

src/converters/MarkdownPreprocessor.ts (1)

146-147: Consider documenting the processing order.

The new Step 5.5 is inserted between embed processing (Step 5) and wikilink processing (Step 6). Consider adding a comment explaining why remote image processing happens after embeds but before wikilinks.

 		// Step 5: Convert embeds FIRST (before wikilinks to avoid .md extension being added)
 		result.content = this.embedProcessor.processEmbeds(result.content, result);

-		// Step 5.5: Handle standard markdown images with remote URLs
+		// Step 5.5: Handle standard markdown images with remote URLs
+		// Process after embeds (which handle ![[]] syntax) but before wikilinks
+		// to ensure remote URLs in standard markdown ![](url) format are queued for download
 		result.content = this.processStandardMarkdownImages(result.content, result);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 536351cbbf and 9ca299cafd.

📒 Files selected for processing (7)
  • CHANGELOG.md (4 hunks)
  • src/converters/MarkdownPreprocessor.ts (3 hunks)
  • src/converters/pandoc/PandocCommandBuilder.ts (1 hunks)
  • src/converters/pdf/BinaryLocator.ts (1 hunks)
  • src/core/PathUtils.ts (2 hunks)
  • src/core/TempDirectoryManager.ts (3 hunks)
  • src/plugin/EmbedProcessor.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts
Add user-facing commands via this.addCommand(...) and use stable command IDs
Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab
Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload
Prefer async/await over promise chains and handle errors gracefully

Files:

  • src/converters/pdf/BinaryLocator.ts
  • src/core/TempDirectoryManager.ts
  • src/core/PathUtils.ts
  • src/converters/pandoc/PandocCommandBuilder.ts
  • src/plugin/EmbedProcessor.ts
  • src/converters/MarkdownPreprocessor.ts
🧠 Learnings (2)
📚 Learning: 2025-09-25T14:27:31.837Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/core/PathUtils.ts:108-119
Timestamp: 2025-09-25T14:27:31.837Z
Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations.

Applied to files:

  • src/converters/pdf/BinaryLocator.ts
  • src/core/TempDirectoryManager.ts
  • src/core/PathUtils.ts
  • src/plugin/EmbedProcessor.ts
  • CHANGELOG.md
📚 Learning: 2025-09-25T14:14:57.437Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/converters/pandoc/ResourcePathResolver.ts:109-111
Timestamp: 2025-09-25T14:14:57.437Z
Learning: In src/converters/pandoc/ResourcePathResolver.ts, the image extension regex /\.(png|jpg|jpeg|gif|svg|webp|bmp|ico|tiff)$/i is intentionally restricted and should not be expanded to include additional formats like .tif, .avif, .heic, .heif as this is a conscious design decision by the maintainer.

Applied to files:

  • src/converters/MarkdownPreprocessor.ts
🧬 Code graph analysis (5)
src/converters/pdf/BinaryLocator.ts (1)
src/core/PathUtils.ts (1)
  • PathUtils (8-150)
src/core/TempDirectoryManager.ts (1)
src/core/constants.ts (1)
  • PLUGIN_DIRS (25-29)
src/core/PathUtils.ts (1)
scripts/package-plugin.js (1)
  • path (12-12)
src/plugin/EmbedProcessor.ts (3)
src/converters/preprocessors/EmbedProcessor.ts (1)
  • EmbedProcessor (54-244)
src/core/PathUtils.ts (1)
  • PathUtils (8-150)
main.ts (1)
  • obsidianTypstPDFExport (30-245)
src/converters/MarkdownPreprocessor.ts (1)
src/converters/preprocessors/WikilinkProcessor.ts (1)
  • PreprocessingResult (20-58)
🔇 Additional comments (8)
src/core/TempDirectoryManager.ts (1)

7-7: Verify necessity of Node.js path module.

The codebase previously preferred to avoid Node.js built-in modules like path in favor of Obsidian API calls for path operations. While Windows absolute path handling may justify this change, ensure this is the intended approach.

Based on learnings.

src/converters/pandoc/PandocCommandBuilder.ts (1)

49-52: LGTM!

The --no-citeproc flag appropriately disables Pandoc's automatic citation processing when no bibliography is provided, preventing false-positive bibliography errors.

src/core/PathUtils.ts (1)

6-6: Verify necessity of Node.js path module.

The codebase previously preferred to avoid Node.js built-in modules like path in favor of Obsidian API calls for path operations. While Windows absolute path handling may justify this change, ensure this is the intended approach.

Based on learnings.

src/converters/pdf/BinaryLocator.ts (1)

133-145: LGTM!

Good refactoring to reuse the PathUtils instance and use centralized joinPath() for path construction. The null-check for the plugin parameter is appropriate.

src/plugin/EmbedProcessor.ts (1)

206-225: LGTM with security note.

The remote URL detection and download logic is appropriate. The 10-second timeout and graceful fallback to placeholder text provide good UX.

However, ensure users are aware that remote images are downloaded without domain validation. Consider documenting this behavior in user-facing documentation.

src/converters/MarkdownPreprocessor.ts (2)

12-12: Verify necessity of Node.js path module.

The codebase previously preferred to avoid Node.js built-in modules like path in favor of Obsidian API calls. While this may be necessary for filename extraction from URLs, ensure this is the intended approach.

Based on learnings.


171-217: LGTM!

The remote image detection and queuing logic is well-implemented. The regex pattern correctly matches standard markdown images, and the URL validation appropriately identifies remote resources. The fallback filename handling when URL parsing fails is robust.

CHANGELOG.md (1)

8-37: LGTM!

The changelog accurately documents the key changes in this PR:

  • Remote image download functionality with timeout and fallback behavior
  • Windows absolute path handling fixes
  • Bibliography error prevention with --no-citeproc

The descriptions are clear, comprehensive, and well-organized by category.

**Actionable comments posted: 1** <details> <summary>🧹 Nitpick comments (6)</summary><blockquote> <details> <summary>src/core/TempDirectoryManager.ts (2)</summary><blockquote> `37-58`: **Simplify path construction logic.** The manual iteration through segments to handle absolute paths replicates behavior already provided by `path.join()`. Node.js `path.join()` automatically handles absolute path segments by resetting the base when an absolute path is encountered. Apply this diff to simplify: ```diff - private getPluginDir(): string { - // Use path.join to properly handle absolute paths - const segments = [this.vaultPath, this.configDir, 'plugins', this.pluginName]; - let result = ''; - - for (const segment of segments) { - if (!segment) continue; - - if (path.isAbsolute(segment)) { - // This segment is absolute, use it as the new base - result = segment; - } else if (result) { - // Join with the current result - result = path.join(result, segment); - } else { - // First relative segment - result = segment; - } - } - - return normalizePath(path.normalize(result)); + private getPluginDir(): string { + // path.join automatically handles absolute paths correctly + const result = path.join(this.vaultPath, this.configDir, 'plugins', this.pluginName); + return normalizePath(result); } ``` --- `133-144`: **Remove redundant path.normalize calls.** The paths are already normalized by `normalizePath()` and passed through `path.join()`, making the additional `path.normalize()` calls redundant. Apply this diff: ```diff public isPluginTempDir(dirPath: string): boolean { const pluginDir = this.getPluginDir(); const normalizedDirPath = normalizePath(dirPath); const normalizedPluginDir = normalizePath(pluginDir); - - // Use path.join to properly handle absolute paths - const tempImagesDir = normalizePath(path.normalize(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_IMAGES))); - const tempPandocDir = normalizePath(path.normalize(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_PANDOC))); + const tempImagesDir = normalizePath(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_IMAGES)); + const tempPandocDir = normalizePath(path.join(normalizedPluginDir, PLUGIN_DIRS.TEMP_PANDOC)); return normalizedDirPath.startsWith(tempImagesDir) || normalizedDirPath.startsWith(tempPandocDir); } ``` </blockquote></details> <details> <summary>src/core/PathUtils.ts (1)</summary><blockquote> `34-62`: **Simplify path joining logic.** The manual iteration to handle absolute paths replicates behavior already provided by `path.join()`. Node.js `path.join()` automatically handles absolute path segments correctly across platforms. Apply this diff to simplify: ```diff joinPath(...segments: string[]): string { - // Filter out empty segments const filtered = segments.filter(s => s); - if (filtered.length === 0) { return ''; } - - // Find the last absolute path in the segments - // If a segment is absolute, it becomes the new base and we ignore previous segments - let result = ''; - for (const segment of filtered) { - if (path.isAbsolute(segment)) { - // This segment is absolute, use it as the new base - result = segment; - } else if (result) { - // Join with the current result - result = path.join(result, segment); - } else { - // First relative segment - result = segment; - } - } - - // Normalize the final path using path.normalize for cross-platform compatibility - // then use Obsidian's normalizePath for vault-relative paths - const normalized = path.normalize(result); - return normalizePath(normalized); + const result = path.join(...filtered); + return normalizePath(result); } ``` Note: `path.join()` already normalizes paths and handles absolute segments by using the last absolute path as the new base. </blockquote></details> <details> <summary>src/plugin/EmbedProcessor.ts (2)</summary><blockquote> `27-104`: **Consider using Obsidian's vault.adapter for file operations.** The implementation uses Node.js `fs` module directly (lines 69, 82) to write downloaded images, bypassing Obsidian's vault.adapter API. This is inconsistent with the codebase's preference for Obsidian APIs. Additionally, there's no check if a file already exists at `outputPath` before writing, which could overwrite existing files or cause concurrent write issues. Consider: 1. Using `this.plugin.app.vault.adapter.writeBinary()` instead of `fs.createWriteStream()` 2. Checking file existence before writing to avoid overwriting Example approach: ```typescript // Check if file exists const exists = await this.pathUtils.fileExists(outputPath); if (exists) { // Handle collision: append timestamp or skip } // Write using vault adapter const chunks: Buffer[] = []; response.on('data', (chunk) => chunks.push(chunk)); response.on('end', async () => { try { const buffer = Buffer.concat(chunks); await this.plugin.app.vault.adapter.writeBinary(outputPath, buffer); resolve(outputPath); } catch (err) { console.error(`Export: Error writing image: ${err.message}`); resolve(null); } }); ``` --- `226-248`: **Consolidate duplicate path resolution logic.** The local file path resolution logic (lines 227-247) duplicates similar logic in `resolvePdfPath()` and `resolveFilePath()` methods. Consider extracting this into a shared helper method. Example: ```typescript private async resolveLocalPath( decodedPath: string, vaultBasePath: string, currentFile?: TFile, additionalPaths: string[] = [] ): Promise<string | null> { const possiblePaths = [ path.resolve(vaultBasePath, decodedPath), currentFile ? path.resolve(vaultBasePath, path.dirname(currentFile.path), decodedPath) : null, ...additionalPaths ].filter((p): p is string => p !== null); for (const possiblePath of possiblePaths) { try { if (await this.pathUtils.fileExists(possiblePath)) { return possiblePath; } } catch { // Continue to next path } } return null; } ``` Then call it from processImageEmbeds, resolvePdfPath, and resolveFilePath. </blockquote></details> <details> <summary>src/converters/MarkdownPreprocessor.ts (1)</summary><blockquote> `146-147`: **Consider documenting the processing order.** The new Step 5.5 is inserted between embed processing (Step 5) and wikilink processing (Step 6). Consider adding a comment explaining why remote image processing happens after embeds but before wikilinks. ```diff // Step 5: Convert embeds FIRST (before wikilinks to avoid .md extension being added) result.content = this.embedProcessor.processEmbeds(result.content, result); - // Step 5.5: Handle standard markdown images with remote URLs + // Step 5.5: Handle standard markdown images with remote URLs + // Process after embeds (which handle ![[]] syntax) but before wikilinks + // to ensure remote URLs in standard markdown ![](url) format are queued for download result.content = this.processStandardMarkdownImages(result.content, result); ``` </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 536351cbbf2e8065f83325a7a4d9b70836f68d38 and 9ca299cafd915a43145a0bfb43acb9fb2d514d37. </details> <details> <summary>📒 Files selected for processing (7)</summary> * `CHANGELOG.md` (4 hunks) * `src/converters/MarkdownPreprocessor.ts` (3 hunks) * `src/converters/pandoc/PandocCommandBuilder.ts` (1 hunks) * `src/converters/pdf/BinaryLocator.ts` (1 hunks) * `src/core/PathUtils.ts` (2 hunks) * `src/core/TempDirectoryManager.ts` (3 hunks) * `src/plugin/EmbedProcessor.ts` (2 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (1)</summary> <details> <summary>src/**/*.ts</summary> **📄 CodeRabbit inference engine (AGENTS.md)** > `src/**/*.ts`: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts > Add user-facing commands via this.addCommand(...) and use stable command IDs > Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab > Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload > Prefer async/await over promise chains and handle errors gracefully Files: - `src/converters/pdf/BinaryLocator.ts` - `src/core/TempDirectoryManager.ts` - `src/core/PathUtils.ts` - `src/converters/pandoc/PandocCommandBuilder.ts` - `src/plugin/EmbedProcessor.ts` - `src/converters/MarkdownPreprocessor.ts` </details> </details><details> <summary>🧠 Learnings (2)</summary> <details> <summary>📚 Learning: 2025-09-25T14:27:31.837Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/core/PathUtils.ts:108-119 Timestamp: 2025-09-25T14:27:31.837Z Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations. ``` **Applied to files:** - `src/converters/pdf/BinaryLocator.ts` - `src/core/TempDirectoryManager.ts` - `src/core/PathUtils.ts` - `src/plugin/EmbedProcessor.ts` - `CHANGELOG.md` </details> <details> <summary>📚 Learning: 2025-09-25T14:14:57.437Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/converters/pandoc/ResourcePathResolver.ts:109-111 Timestamp: 2025-09-25T14:14:57.437Z Learning: In src/converters/pandoc/ResourcePathResolver.ts, the image extension regex /\.(png|jpg|jpeg|gif|svg|webp|bmp|ico|tiff)$/i is intentionally restricted and should not be expanded to include additional formats like .tif, .avif, .heic, .heif as this is a conscious design decision by the maintainer. ``` **Applied to files:** - `src/converters/MarkdownPreprocessor.ts` </details> </details><details> <summary>🧬 Code graph analysis (5)</summary> <details> <summary>src/converters/pdf/BinaryLocator.ts (1)</summary><blockquote> <details> <summary>src/core/PathUtils.ts (1)</summary> * `PathUtils` (8-150) </details> </blockquote></details> <details> <summary>src/core/TempDirectoryManager.ts (1)</summary><blockquote> <details> <summary>src/core/constants.ts (1)</summary> * `PLUGIN_DIRS` (25-29) </details> </blockquote></details> <details> <summary>src/core/PathUtils.ts (1)</summary><blockquote> <details> <summary>scripts/package-plugin.js (1)</summary> * `path` (12-12) </details> </blockquote></details> <details> <summary>src/plugin/EmbedProcessor.ts (3)</summary><blockquote> <details> <summary>src/converters/preprocessors/EmbedProcessor.ts (1)</summary> * `EmbedProcessor` (54-244) </details> <details> <summary>src/core/PathUtils.ts (1)</summary> * `PathUtils` (8-150) </details> <details> <summary>main.ts (1)</summary> * `obsidianTypstPDFExport` (30-245) </details> </blockquote></details> <details> <summary>src/converters/MarkdownPreprocessor.ts (1)</summary><blockquote> <details> <summary>src/converters/preprocessors/WikilinkProcessor.ts (1)</summary> * `PreprocessingResult` (20-58) </details> </blockquote></details> </details> </details> <details> <summary>🔇 Additional comments (8)</summary><blockquote> <details> <summary>src/core/TempDirectoryManager.ts (1)</summary><blockquote> `7-7`: **Verify necessity of Node.js `path` module.** The codebase previously preferred to avoid Node.js built-in modules like `path` in favor of Obsidian API calls for path operations. While Windows absolute path handling may justify this change, ensure this is the intended approach. Based on learnings. </blockquote></details> <details> <summary>src/converters/pandoc/PandocCommandBuilder.ts (1)</summary><blockquote> `49-52`: **LGTM!** The `--no-citeproc` flag appropriately disables Pandoc's automatic citation processing when no bibliography is provided, preventing false-positive bibliography errors. </blockquote></details> <details> <summary>src/core/PathUtils.ts (1)</summary><blockquote> `6-6`: **Verify necessity of Node.js `path` module.** The codebase previously preferred to avoid Node.js built-in modules like `path` in favor of Obsidian API calls for path operations. While Windows absolute path handling may justify this change, ensure this is the intended approach. Based on learnings. </blockquote></details> <details> <summary>src/converters/pdf/BinaryLocator.ts (1)</summary><blockquote> `133-145`: **LGTM!** Good refactoring to reuse the PathUtils instance and use centralized `joinPath()` for path construction. The null-check for the plugin parameter is appropriate. </blockquote></details> <details> <summary>src/plugin/EmbedProcessor.ts (1)</summary><blockquote> `206-225`: **LGTM with security note.** The remote URL detection and download logic is appropriate. The 10-second timeout and graceful fallback to placeholder text provide good UX. However, ensure users are aware that remote images are downloaded without domain validation. Consider documenting this behavior in user-facing documentation. </blockquote></details> <details> <summary>src/converters/MarkdownPreprocessor.ts (2)</summary><blockquote> `12-12`: **Verify necessity of Node.js `path` module.** The codebase previously preferred to avoid Node.js built-in modules like `path` in favor of Obsidian API calls. While this may be necessary for filename extraction from URLs, ensure this is the intended approach. Based on learnings. --- `171-217`: **LGTM!** The remote image detection and queuing logic is well-implemented. The regex pattern correctly matches standard markdown images, and the URL validation appropriately identifies remote resources. The fallback filename handling when URL parsing fails is robust. </blockquote></details> <details> <summary>CHANGELOG.md (1)</summary><blockquote> `8-37`: **LGTM!** The changelog accurately documents the key changes in this PR: - Remote image download functionality with timeout and fallback behavior - Windows absolute path handling fixes - Bibliography error prevention with `--no-citeproc` The descriptions are clear, comprehensive, and well-organized by category. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@@ -8,0 +29,4 @@
* Configuration options for TempDirectoryManager initialization.
*
* @property vaultPath - Absolute path to the vault root directory
* @property configDir - Configuration directory path (typically '.obsidian')
coderabbitai[bot] (Migrated from github.com) commented 2025-11-04 11:02:16 +01:00

🛠️ Refactor suggestion | 🟠 Major

Remove redundant ternary operator.

Lines 69-71 have a redundant ternary that returns the same result in both branches.

Apply this diff:

 	public getTempDir(type: 'images' | 'pandoc'): string {
 		const dirName = type === 'images' ? PLUGIN_DIRS.TEMP_IMAGES : PLUGIN_DIRS.TEMP_PANDOC;
 		const pluginDir = this.getPluginDir();
-
-		// Use path.join to properly handle absolute paths
-		const result = path.isAbsolute(pluginDir)
-			? path.join(pluginDir, dirName)
-			: path.join(pluginDir, dirName);
-
-		return normalizePath(path.normalize(result));
+		const result = path.join(pluginDir, dirName);
+		return normalizePath(result);
 	}
🤖 Prompt for AI Agents
In src/core/TempDirectoryManager.ts around lines 64 to 74, the code uses a
redundant ternary when building result (both branches call path.join(pluginDir,
dirName)); remove the ternary and directly compute result with
path.join(pluginDir, dirName). Keep the existing
normalizePath(path.normalize(...)) wrapping and ensure you preserve the
selection of dirName earlier.

✅ Addressed in commits 501f380 to 4a0376e

_🛠️ Refactor suggestion_ | _🟠 Major_ **Remove redundant ternary operator.** Lines 69-71 have a redundant ternary that returns the same result in both branches. Apply this diff: ```diff public getTempDir(type: 'images' | 'pandoc'): string { const dirName = type === 'images' ? PLUGIN_DIRS.TEMP_IMAGES : PLUGIN_DIRS.TEMP_PANDOC; const pluginDir = this.getPluginDir(); - - // Use path.join to properly handle absolute paths - const result = path.isAbsolute(pluginDir) - ? path.join(pluginDir, dirName) - : path.join(pluginDir, dirName); - - return normalizePath(path.normalize(result)); + const result = path.join(pluginDir, dirName); + return normalizePath(result); } ``` <details> <summary>🤖 Prompt for AI Agents</summary> ``` In src/core/TempDirectoryManager.ts around lines 64 to 74, the code uses a redundant ternary when building result (both branches call path.join(pluginDir, dirName)); remove the ternary and directly compute result with path.join(pluginDir, dirName). Keep the existing normalizePath(path.normalize(...)) wrapping and ensure you preserve the selection of dirName earlier. ``` </details> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits 501f380 to 4a0376e
coderabbitai[bot] commented 2025-11-04 11:17:30 +01:00 (Migrated from github.com)

Caution

Docstrings generation - FAILED

No docstrings were generated.

> [!CAUTION] > Docstrings generation - FAILED > > No docstrings were generated. <!--DOCSTRING_INTERNAL_START_STATE>N4Igxg9gtlCWAuBJAJiAXCALAQwAwGYB2ANgFMwAmAIwE4KKAOGwgMwFYwHdTidvCKxBtmz4aXNgRAAaEACdSAN1ikA7gH0AzvGzwArpvQhScuRDkgAvkA== <!--DOCSTRING_INTERNAL_END_STATE>
coderabbitai[bot] (Migrated from github.com) reviewed 2025-11-04 11:24:47 +01:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ca299cafd and 4a0376ec2b.

📒 Files selected for processing (4)
  • src/converters/MarkdownPreprocessor.ts (3 hunks)
  • src/core/PathUtils.ts (2 hunks)
  • src/core/TempDirectoryManager.ts (3 hunks)
  • src/plugin/EmbedProcessor.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/core/PathUtils.ts
  • src/converters/MarkdownPreprocessor.ts
  • src/core/TempDirectoryManager.ts
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts
Add user-facing commands via this.addCommand(...) and use stable command IDs
Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab
Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload
Prefer async/await over promise chains and handle errors gracefully

Files:

  • src/plugin/EmbedProcessor.ts
🧠 Learnings (2)
📚 Learning: 2025-09-25T14:27:31.837Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/core/PathUtils.ts:108-119
Timestamp: 2025-09-25T14:27:31.837Z
Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations.

Applied to files:

  • src/plugin/EmbedProcessor.ts
📚 Learning: 2025-09-25T14:14:57.437Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/converters/pandoc/ResourcePathResolver.ts:109-111
Timestamp: 2025-09-25T14:14:57.437Z
Learning: In src/converters/pandoc/ResourcePathResolver.ts, the image extension regex /\.(png|jpg|jpeg|gif|svg|webp|bmp|ico|tiff)$/i is intentionally restricted and should not be expanded to include additional formats like .tif, .avif, .heic, .heif as this is a conscious design decision by the maintainer.

Applied to files:

  • src/plugin/EmbedProcessor.ts
🧬 Code graph analysis (1)
src/plugin/EmbedProcessor.ts (3)
src/converters/preprocessors/EmbedProcessor.ts (1)
  • EmbedProcessor (54-244)
src/core/PathUtils.ts (1)
  • PathUtils (8-129)
main.ts (1)
  • obsidianTypstPDFExport (30-245)
**Actionable comments posted: 2** <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 9ca299cafd915a43145a0bfb43acb9fb2d514d37 and 4a0376ec2b922897f5c80e64a0e7268aa3980503. </details> <details> <summary>📒 Files selected for processing (4)</summary> * `src/converters/MarkdownPreprocessor.ts` (3 hunks) * `src/core/PathUtils.ts` (2 hunks) * `src/core/TempDirectoryManager.ts` (3 hunks) * `src/plugin/EmbedProcessor.ts` (4 hunks) </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (3)</summary> * src/core/PathUtils.ts * src/converters/MarkdownPreprocessor.ts * src/core/TempDirectoryManager.ts </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (1)</summary> <details> <summary>src/**/*.ts</summary> **📄 CodeRabbit inference engine (AGENTS.md)** > `src/**/*.ts`: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts > Add user-facing commands via this.addCommand(...) and use stable command IDs > Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab > Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload > Prefer async/await over promise chains and handle errors gracefully Files: - `src/plugin/EmbedProcessor.ts` </details> </details><details> <summary>🧠 Learnings (2)</summary> <details> <summary>📚 Learning: 2025-09-25T14:27:31.837Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/core/PathUtils.ts:108-119 Timestamp: 2025-09-25T14:27:31.837Z Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations. ``` **Applied to files:** - `src/plugin/EmbedProcessor.ts` </details> <details> <summary>📚 Learning: 2025-09-25T14:14:57.437Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/converters/pandoc/ResourcePathResolver.ts:109-111 Timestamp: 2025-09-25T14:14:57.437Z Learning: In src/converters/pandoc/ResourcePathResolver.ts, the image extension regex /\.(png|jpg|jpeg|gif|svg|webp|bmp|ico|tiff)$/i is intentionally restricted and should not be expanded to include additional formats like .tif, .avif, .heic, .heif as this is a conscious design decision by the maintainer. ``` **Applied to files:** - `src/plugin/EmbedProcessor.ts` </details> </details><details> <summary>🧬 Code graph analysis (1)</summary> <details> <summary>src/plugin/EmbedProcessor.ts (3)</summary><blockquote> <details> <summary>src/converters/preprocessors/EmbedProcessor.ts (1)</summary> * `EmbedProcessor` (54-244) </details> <details> <summary>src/core/PathUtils.ts (1)</summary> * `PathUtils` (8-129) </details> <details> <summary>main.ts (1)</summary> * `obsidianTypstPDFExport` (30-245) </details> </blockquote></details> </details> </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@@ -19,0 +103,4 @@
? fileName // Has an extension, preserve it
: `${fileName}.png`; // No extension, append .png
const outputPath = path.join(tempDir, finalFileName);
coderabbitai[bot] (Migrated from github.com) commented 2025-11-04 11:24:46 +01:00

⚠️ Potential issue | 🟠 Major

Preserve original image extensions instead of forcing .png.

When a remote file ends with something like .svg, we append .png without converting the contents. That leaves us with an SVG payload masquerading as PNG, so Typst/Pandoc will fail to decode the asset. Please keep the on-disk extension if one is present (at least include .svg, .ico, etc. in validExtensions, or only fall back to .png when the URL truly lacks an extension). Based on learnings

🤖 Prompt for AI Agents
In src/plugin/EmbedProcessor.ts around lines 96 to 103, the current logic forces
a .png when the file extension isn't in a small whitelist, which causes
mismatched on-disk extensions for assets like .svg or .ico; change the logic to
preserve any existing extension returned by path.extname (after normalizing and
stripping query/fragments) and only append .png when no extension is present (or
the ext is empty), or alternatively expand the validExtensions list to include
common types like .svg, .ico, .avif, .svgz; ensure you normalize ext via
toLowerCase() and treat extensions with query strings correctly so the
finalFileName uses the original extension when present and only falls back to
.png when the URL truly lacks one.

✅ Addressed in commits 7ac9e1f to 4eb52d1

_⚠️ Potential issue_ | _🟠 Major_ **Preserve original image extensions instead of forcing `.png`.** When a remote file ends with something like `.svg`, we append `.png` without converting the contents. That leaves us with an SVG payload masquerading as PNG, so Typst/Pandoc will fail to decode the asset. Please keep the on-disk extension if one is present (at least include `.svg`, `.ico`, etc. in `validExtensions`, or only fall back to `.png` when the URL truly lacks an extension). Based on learnings <details> <summary>🤖 Prompt for AI Agents</summary> ``` In src/plugin/EmbedProcessor.ts around lines 96 to 103, the current logic forces a .png when the file extension isn't in a small whitelist, which causes mismatched on-disk extensions for assets like .svg or .ico; change the logic to preserve any existing extension returned by path.extname (after normalizing and stripping query/fragments) and only append .png when no extension is present (or the ext is empty), or alternatively expand the validExtensions list to include common types like .svg, .ico, .avif, .svgz; ensure you normalize ext via toLowerCase() and treat extensions with query strings correctly so the finalFileName uses the original extension when present and only falls back to .png when the URL truly lacks one. ``` </details> <!-- fingerprinting:phantom:medusa:sabertoothed --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits 7ac9e1f to 4eb52d1
@@ -19,0 +123,4 @@
console.log(`Export: Following redirect to: ${absoluteRedirectUrl}`);
// Recursively follow redirect with resolved absolute URL
this.downloadRemoteImage(absoluteRedirectUrl, tempDir).then(resolve);
return;
coderabbitai[bot] (Migrated from github.com) commented 2025-11-04 11:24:46 +01:00

⚠️ Potential issue | 🟠 Major

Handle relative redirects when downloading images.

Redirects such as Location: /assets/img.png are valid but new URL(redirectUrl) will throw without the original request as a base, causing every relative redirect download to fail. Pass the original URL to new URL(...) (or otherwise resolve before recursing) so remote images behind relative redirects work.

🤖 Prompt for AI Agents
In src/plugin/EmbedProcessor.ts around lines 112 to 118, the code assumes
Location is an absolute URL and calls new URL(redirectUrl) which throws for
relative redirects; resolve redirectUrl against the original request URL (e.g.,
use new URL(redirectUrl, originalRequestUrl) or URL.resolve equivalent) to
produce an absolute URL, then pass that resolved absolute URL into
this.downloadRemoteImage(...) when recursing so relative Location headers (like
"/assets/img.png") are handled correctly.

✅ Addressed in commits 7ac9e1f to 4eb52d1

_⚠️ Potential issue_ | _🟠 Major_ **Handle relative redirects when downloading images.** Redirects such as `Location: /assets/img.png` are valid but `new URL(redirectUrl)` will throw without the original request as a base, causing every relative redirect download to fail. Pass the original URL to `new URL(...)` (or otherwise resolve before recursing) so remote images behind relative redirects work. <details> <summary>🤖 Prompt for AI Agents</summary> ``` In src/plugin/EmbedProcessor.ts around lines 112 to 118, the code assumes Location is an absolute URL and calls new URL(redirectUrl) which throws for relative redirects; resolve redirectUrl against the original request URL (e.g., use new URL(redirectUrl, originalRequestUrl) or URL.resolve equivalent) to produce an absolute URL, then pass that resolved absolute URL into this.downloadRemoteImage(...) when recursing so relative Location headers (like "/assets/img.png") are handled correctly. ``` </details> <!-- fingerprinting:phantom:medusa:sabertoothed --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits 7ac9e1f to 4eb52d1
coderabbitai[bot] (Migrated from github.com) reviewed 2025-11-05 08:19:19 +01:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
src/converters/PandocTypstConverter.ts (2)

190-198: Don't claim success on failure paths.

progressCallback?.('Conversion complete!', 100); fires even when result.success is false, so the UI reports a 100 % success message on failed exports. Guard this so the success message only emits when the conversion actually succeeded, or emit a failure update instead.

-			progressCallback?.('Conversion complete!', 100);
+			if (result.success) {
+				progressCallback?.('Conversion complete!', 100);
+			}

294-303: Unwind global process listeners and drop uncaughtException hook.

Every converter instantiation registers four process.on handlers that are never removed. Over time this leaks listeners, prevents the converter from being garbage-collected, and will eventually hit Node’s listener cap. Worse, the uncaughtException handler swallows the error (Node stops exiting once a handler is present), so any unrelated crash just triggers cleanup and the original error disappears. Please register these handlers once (or store them and remove them in dispose/cleanup) and avoid the global uncaughtException hook—or at least rethrow/exit after cleanup so errors are not silently consumed.

src/core/ExecutableChecker.ts (1)

80-92: Fix PATH delimiter handling on Windows.

getAugmentedPath always uses : when joining PATH segments, which corrupts PATH entries on Windows (they are ;-delimited). Once this runs, any appended directory becomes part of the previous entry, so executables in those locations stop resolving—negating the Windows path fixes this PR is targeting.(cs.unb.ca)

Please join with the platform-specific separator (via path.delimiter or process.platform) and skip empty segments so existing PATH contents stay intact. For example:

-		return `${process.env.PATH}:${allAdditionalPaths.join(':')}`;
+		const delimiter = process.platform === 'win32' ? ';' : ':';
+		const segments = [
+			process.env.PATH ?? '',
+			...allAdditionalPaths.filter(p => p && p.trim() !== '')
+		];
+		return segments.filter(Boolean).join(delimiter);
src/core/SecurityUtils.ts (1)

129-136: Fix reserved-name check for nested segments

The reserved-name guard only matches when the entire normalized path equals a device name. Windows still rejects segments like reports/CON/report.pdf or AUX.txt, so malicious or unlucky input slips through and the export blows up later when we try to create the directory. Please split the path into segments (both / and \) and check each (ignoring '.'/'') against the reserved-name list, treating names with extensions as invalid too.

Apply this diff to harden the validation:

-			/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i  // Windows reserved names
+			(): void => {
+				const reserved = /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i;
+				return normalizedPath
+					.split(/[\\/]+/)
+					.filter(segment => segment && segment !== '.')
+					.some(segment => reserved.test(segment.split('.')[0] ?? ''));
+			}

(Replace the existing regex entry with a function that inspects each segment.)

🧹 Nitpick comments (1)
src/core/TempDirectoryManager.ts (1)

207-210: Consider removing redundant path.normalize call.

Line 210 applies both path.normalize() and normalizePath() to the result. Since normalizePath() (from Obsidian) already handles path normalization and ensures forward slashes, the intermediate path.normalize() call may be redundant and could potentially interfere with Obsidian's normalization.

Consider this simplification:

 	// Use path.join to properly handle absolute paths
 	const result = path.join(pluginDir, dirName);
 
-	return normalizePath(path.normalize(result));
+	return normalizePath(result);

The same pattern appears in isPluginTempDir at lines 447-448, which may also benefit from removing the intermediate path.join after normalization is already applied.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a0376ec2b and 4eb52d11c0.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (27)
  • .gitignore (1 hunks)
  • package.json (2 hunks)
  • src/converters/MarkdownPreprocessor.ts (10 hunks)
  • src/converters/PandocTypstConverter.ts (9 hunks)
  • src/converters/PdfToImageConverter.ts (6 hunks)
  • src/converters/pandoc/PandocCommandBuilder.ts (8 hunks)
  • src/converters/pandoc/PandocExecutor.ts (4 hunks)
  • src/core/DependencyChecker.ts (6 hunks)
  • src/core/ExecutableChecker.ts (8 hunks)
  • src/core/ExportErrorHandler.ts (9 hunks)
  • src/core/ModalSettingsHelper.ts (5 hunks)
  • src/core/PathUtils.ts (4 hunks)
  • src/core/SecurityUtils.ts (4 hunks)
  • src/core/TempDirectoryManager.ts (6 hunks)
  • src/core/constants.ts (5 hunks)
  • src/core/settings.ts (2 hunks)
  • src/plugin/EmbedProcessor.ts (4 hunks)
  • tests/ModalSettingsHelper.test.ts (1 hunks)
  • tests/SecurityUtils.test.ts (1 hunks)
  • tests/TempDirectoryManager.test.ts (1 hunks)
  • tests/TypstVariableMapper.test.ts (1 hunks)
  • tests/__mocks__/obsidian.ts (1 hunks)
  • tests/basicCoverage.test.ts (1 hunks)
  • tests/converterTypes.test.ts (1 hunks)
  • tests/paperSizeMapper.test.ts (1 hunks)
  • tests/setup.ts (1 hunks)
  • vitest.config.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • tests/SecurityUtils.test.ts
  • tests/ModalSettingsHelper.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
package.json

📄 CodeRabbit inference engine (AGENTS.md)

Use npm as the package manager (project scripts and deps defined in package.json)

Files:

  • package.json
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts
Add user-facing commands via this.addCommand(...) and use stable command IDs
Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab
Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload
Prefer async/await over promise chains and handle errors gracefully

Files:

  • src/converters/pandoc/PandocExecutor.ts
  • src/core/ModalSettingsHelper.ts
  • src/core/DependencyChecker.ts
  • src/plugin/EmbedProcessor.ts
  • src/core/SecurityUtils.ts
  • src/converters/PandocTypstConverter.ts
  • src/converters/MarkdownPreprocessor.ts
  • src/converters/PdfToImageConverter.ts
  • src/converters/pandoc/PandocCommandBuilder.ts
  • src/core/settings.ts
  • src/core/PathUtils.ts
  • src/core/TempDirectoryManager.ts
  • src/core/ExportErrorHandler.ts
  • src/core/ExecutableChecker.ts
  • src/core/constants.ts
🧠 Learnings (5)
📚 Learning: 2025-09-25T14:48:20.040Z
Learnt from: CR
Repo: AlexKucera/obsidian-typst-pdf-export PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-25T14:48:20.040Z
Learning: Applies to esbuild.config.mjs : Use esbuild for bundling (this sample relies on esbuild.config.mjs)

Applied to files:

  • package.json
📚 Learning: 2025-09-25T14:27:31.837Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/core/PathUtils.ts:108-119
Timestamp: 2025-09-25T14:27:31.837Z
Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations.

Applied to files:

  • src/plugin/EmbedProcessor.ts
  • tests/__mocks__/obsidian.ts
  • src/converters/PdfToImageConverter.ts
  • src/core/PathUtils.ts
  • src/core/TempDirectoryManager.ts
  • src/core/ExecutableChecker.ts
  • src/core/constants.ts
📚 Learning: 2025-09-25T14:14:57.437Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/converters/pandoc/ResourcePathResolver.ts:109-111
Timestamp: 2025-09-25T14:14:57.437Z
Learning: In src/converters/pandoc/ResourcePathResolver.ts, the image extension regex /\.(png|jpg|jpeg|gif|svg|webp|bmp|ico|tiff)$/i is intentionally restricted and should not be expanded to include additional formats like .tif, .avif, .heic, .heif as this is a conscious design decision by the maintainer.

Applied to files:

  • src/plugin/EmbedProcessor.ts
  • src/converters/PdfToImageConverter.ts
📚 Learning: 2025-09-25T14:48:20.040Z
Learnt from: CR
Repo: AlexKucera/obsidian-typst-pdf-export PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-25T14:48:20.040Z
Learning: Applies to src/**/*.ts : Add user-facing commands via this.addCommand(...) and use stable command IDs

Applied to files:

  • src/converters/pandoc/PandocCommandBuilder.ts
📚 Learning: 2025-09-25T14:48:20.040Z
Learnt from: CR
Repo: AlexKucera/obsidian-typst-pdf-export PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-25T14:48:20.040Z
Learning: Applies to src/**/*.ts : Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab

Applied to files:

  • src/core/settings.ts
🧬 Code graph analysis (14)
tests/TempDirectoryManager.test.ts (2)
tests/__mocks__/obsidian.ts (1)
  • App (54-65)
src/core/TempDirectoryManager.ts (1)
  • TempDirectoryManager (117-453)
src/converters/pandoc/PandocExecutor.ts (2)
src/plugin/PathResolver.ts (1)
  • PathResolver (12-87)
src/converters/converterTypes.ts (1)
  • PandocOptions (5-30)
src/core/ModalSettingsHelper.ts (1)
tests/__mocks__/obsidian.ts (1)
  • TFile (36-40)
tests/paperSizeMapper.test.ts (1)
src/utils/paperSizeMapper.ts (5)
  • SUPPORTED_PAPER_SIZES (17-58)
  • DEFAULT_PAPER_SIZE (63-63)
  • isSupportedPaperSize (96-98)
  • mapToTypstPaperSize (70-81)
  • getValidTypstPaperSizes (87-89)
src/plugin/EmbedProcessor.ts (3)
src/core/PathUtils.ts (1)
  • PathUtils (29-251)
main.ts (1)
  • obsidianTypstPDFExport (30-245)
tests/__mocks__/obsidian.ts (1)
  • TFile (36-40)
vitest.config.ts (1)
scripts/package-plugin.js (1)
  • path (12-12)
tests/basicCoverage.test.ts (2)
src/core/constants.ts (4)
  • FALLBACK_FONTS (52-64)
  • PLUGIN_DIRS (89-93)
  • EXPORT_CONSTANTS (122-128)
  • DEPENDENCY_CONSTANTS (187-252)
src/utils/paperSizeMapper.ts (4)
  • SUPPORTED_PAPER_SIZES (17-58)
  • mapToTypstPaperSize (70-81)
  • isSupportedPaperSize (96-98)
  • DEFAULT_PAPER_SIZE (63-63)
tests/TypstVariableMapper.test.ts (3)
src/core/settings.ts (1)
  • obsidianTypstPDFExportSettings (75-230)
src/converters/pandoc/TypstVariableMapper.ts (1)
  • TypstVariableMapper (16-324)
src/converters/converterTypes.ts (1)
  • PandocOptions (5-30)
src/converters/MarkdownPreprocessor.ts (2)
src/converters/preprocessors/WikilinkProcessor.ts (1)
  • PreprocessingResult (20-58)
src/converters/preprocessors/EmbedProcessor.ts (1)
  • PreprocessingResult (14-52)
src/converters/PdfToImageConverter.ts (2)
main.ts (1)
  • obsidianTypstPDFExport (30-245)
src/converters/pdf/PdfProcessor.ts (1)
  • PdfProcessor (19-108)
src/converters/pandoc/PandocCommandBuilder.ts (4)
src/converters/pandoc/TypstVariableMapper.ts (1)
  • TypstVariableMapper (16-324)
src/converters/pandoc/ResourcePathResolver.ts (1)
  • ResourcePathResolver (8-142)
src/plugin/PathResolver.ts (1)
  • PathResolver (12-87)
src/converters/converterTypes.ts (1)
  • PandocOptions (5-30)
src/core/PathUtils.ts (1)
tests/__mocks__/obsidian.ts (2)
  • App (54-65)
  • normalizePath (47-49)
src/core/TempDirectoryManager.ts (2)
tests/__mocks__/obsidian.ts (2)
  • App (54-65)
  • normalizePath (47-49)
src/core/constants.ts (1)
  • PLUGIN_DIRS (89-93)
src/core/ExportErrorHandler.ts (1)
tests/__mocks__/obsidian.ts (1)
  • Notice (4-6)
🔇 Additional comments (6)
tests/TempDirectoryManager.test.ts (1)

1-368: LGTM! Comprehensive test coverage.

The test suite thoroughly exercises all public methods of TempDirectoryManager with proper mocking, error handling scenarios, and cross-platform path validation. The tests cover:

  • Constructor and factory method initialization
  • Directory path resolution for both 'images' and 'pandoc' types
  • Directory creation with existence checks
  • Cleanup operations with file removal and error handling
  • Path validation for security checks
  • Windows-style path normalization
src/core/settings.ts (1)

1-341: LGTM! Excellent settings architecture and documentation.

The settings module provides a well-designed configuration schema with:

  • Clear separation of concerns (paths, executables, export defaults, typography, page setup, behavior)
  • Comprehensive JSDoc explaining purpose, usage, and lifecycle of each setting
  • Sensible defaults that work out-of-the-box
  • Type safety through TypeScript interfaces and enums
  • Detailed examples showing how settings are loaded, merged, and used

The documentation quality is exceptional and will help future maintainers understand the configuration system.

src/core/ModalSettingsHelper.ts (1)

1-279: LGTM! Clean API design with excellent documentation.

The ModalSettingsHelper provides a well-structured interface for transforming plugin settings into modal configuration:

  • Clear separation between single-file and multi-file export preparation
  • Automatic template variable extraction from plugin settings
  • Smart handling of multi-file scenarios (count display, file arrays)
  • Landscape mode width adjustment for single-page exports
  • Comprehensive JSDoc with multiple usage examples

The static method design promotes clean, stateless operation and simplifies testing.

src/core/TempDirectoryManager.ts (2)

26-26: Node.js 'path' module usage is intentional for cross-platform support.

While past learnings indicate a preference to avoid Node.js built-in modules in favor of Obsidian API calls, the use of the 'path' module here aligns with the PR objectives to resolve Windows path handling issues. The Node.js 'path' module provides robust cross-platform path operations (especially for Windows drive letters and absolute path handling) that complement Obsidian's normalizePath function.

Based on learnings


1-452: Excellent implementation with comprehensive documentation.

The TempDirectoryManager provides robust temporary directory management with:

  • Cross-platform path handling using Node.js path utilities + Obsidian normalizePath
  • Automatic directory creation on first use
  • Safe cleanup preserving directory structure
  • Security validation to prevent directory traversal
  • Comprehensive error handling with console warnings rather than exceptions
  • Well-documented lifecycle and usage patterns

The singleton pattern via static create() and extensive JSDoc make this class easy to use and maintain.

src/converters/PdfToImageConverter.ts (1)

1-631: LGTM! Excellent converter architecture with outstanding documentation.

The PdfToImageConverter provides a robust, well-documented singleton for PDF-to-image conversion:

Strengths:

  • Clear separation of concerns via delegation to specialized utilities (PdfProcessor, PdfCliExecutor, FileDiscovery, ImageOptimizer)
  • Proper singleton pattern with plugin reference updates
  • Comprehensive error handling that returns results rather than throwing exceptions
  • Detailed JSDoc with multiple usage examples for each method
  • Well-defined interfaces (PdfConversionOptions, PdfConversionResult) with sensible defaults
  • Multi-stage pipeline with validation, conversion, discovery, and optimization

Architecture Benefits:

  • First-page-only conversion is fast and suitable for preview purposes
  • Configurable quality/dimensions for different use cases
  • Error messages preserve context for debugging
  • Modular design allows easy extension for multi-page conversion
  • Plugin reference enables vault file operations via PathUtils

The documentation quality is exceptional and the implementation is production-ready.

**Actionable comments posted: 1** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to platform limitations. > > > > <details> > <summary>⚠️ Outside diff range comments (4)</summary><blockquote> > > <details> > <summary>src/converters/PandocTypstConverter.ts (2)</summary><blockquote> > > `190-198`: **Don't claim success on failure paths.** > > `progressCallback?.('Conversion complete!', 100);` fires even when `result.success` is false, so the UI reports a 100 % success message on failed exports. Guard this so the success message only emits when the conversion actually succeeded, or emit a failure update instead. > > ```diff > - progressCallback?.('Conversion complete!', 100); > + if (result.success) { > + progressCallback?.('Conversion complete!', 100); > + } > ``` > > --- > > `294-303`: **Unwind global process listeners and drop `uncaughtException` hook.** > > Every converter instantiation registers four `process.on` handlers that are never removed. Over time this leaks listeners, prevents the converter from being garbage-collected, and will eventually hit Node’s listener cap. Worse, the `uncaughtException` handler swallows the error (Node stops exiting once a handler is present), so any unrelated crash just triggers cleanup and the original error disappears. Please register these handlers once (or store them and remove them in `dispose/cleanup`) and avoid the global `uncaughtException` hook—or at least rethrow/exit after cleanup so errors are not silently consumed. > > </blockquote></details> > <details> > <summary>src/core/ExecutableChecker.ts (1)</summary><blockquote> > > `80-92`: **Fix PATH delimiter handling on Windows.** > > `getAugmentedPath` always uses `:` when joining PATH segments, which corrupts PATH entries on Windows (they are `;`-delimited). Once this runs, any appended directory becomes part of the previous entry, so executables in those locations stop resolving—negating the Windows path fixes this PR is targeting.([cs.unb.ca](https://www.cs.unb.ca/~bremner/teaching/cs2613/books/nodejs-api/path/)) > > Please join with the platform-specific separator (via `path.delimiter` or `process.platform`) and skip empty segments so existing PATH contents stay intact. For example: > > ```diff > - return `${process.env.PATH}:${allAdditionalPaths.join(':')}`; > + const delimiter = process.platform === 'win32' ? ';' : ':'; > + const segments = [ > + process.env.PATH ?? '', > + ...allAdditionalPaths.filter(p => p && p.trim() !== '') > + ]; > + return segments.filter(Boolean).join(delimiter); > ``` > > </blockquote></details> > <details> > <summary>src/core/SecurityUtils.ts (1)</summary><blockquote> > > `129-136`: **Fix reserved-name check for nested segments** > > The reserved-name guard only matches when the entire normalized path equals a device name. Windows still rejects segments like `reports/CON/report.pdf` or `AUX.txt`, so malicious or unlucky input slips through and the export blows up later when we try to create the directory. Please split the path into segments (both `/` and `\`) and check each (ignoring `'.'`/`''`) against the reserved-name list, treating names with extensions as invalid too. > > Apply this diff to harden the validation: > > ```diff > - /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i // Windows reserved names > + (): void => { > + const reserved = /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i; > + return normalizedPath > + .split(/[\\/]+/) > + .filter(segment => segment && segment !== '.') > + .some(segment => reserved.test(segment.split('.')[0] ?? '')); > + } > ``` > > (Replace the existing regex entry with a function that inspects each segment.) > > </blockquote></details> > > </blockquote></details> <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>src/core/TempDirectoryManager.ts (1)</summary><blockquote> `207-210`: **Consider removing redundant path.normalize call.** Line 210 applies both `path.normalize()` and `normalizePath()` to the result. Since `normalizePath()` (from Obsidian) already handles path normalization and ensures forward slashes, the intermediate `path.normalize()` call may be redundant and could potentially interfere with Obsidian's normalization. Consider this simplification: ```diff // Use path.join to properly handle absolute paths const result = path.join(pluginDir, dirName); - return normalizePath(path.normalize(result)); + return normalizePath(result); ``` The same pattern appears in `isPluginTempDir` at lines 447-448, which may also benefit from removing the intermediate `path.join` after normalization is already applied. </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4a0376ec2b922897f5c80e64a0e7268aa3980503 and 4eb52d11c002c4b89b40e35fa3a8b947e1d14f9a. </details> <details> <summary>⛔ Files ignored due to path filters (1)</summary> * `package-lock.json` is excluded by `!**/package-lock.json` </details> <details> <summary>📒 Files selected for processing (27)</summary> * `.gitignore` (1 hunks) * `package.json` (2 hunks) * `src/converters/MarkdownPreprocessor.ts` (10 hunks) * `src/converters/PandocTypstConverter.ts` (9 hunks) * `src/converters/PdfToImageConverter.ts` (6 hunks) * `src/converters/pandoc/PandocCommandBuilder.ts` (8 hunks) * `src/converters/pandoc/PandocExecutor.ts` (4 hunks) * `src/core/DependencyChecker.ts` (6 hunks) * `src/core/ExecutableChecker.ts` (8 hunks) * `src/core/ExportErrorHandler.ts` (9 hunks) * `src/core/ModalSettingsHelper.ts` (5 hunks) * `src/core/PathUtils.ts` (4 hunks) * `src/core/SecurityUtils.ts` (4 hunks) * `src/core/TempDirectoryManager.ts` (6 hunks) * `src/core/constants.ts` (5 hunks) * `src/core/settings.ts` (2 hunks) * `src/plugin/EmbedProcessor.ts` (4 hunks) * `tests/ModalSettingsHelper.test.ts` (1 hunks) * `tests/SecurityUtils.test.ts` (1 hunks) * `tests/TempDirectoryManager.test.ts` (1 hunks) * `tests/TypstVariableMapper.test.ts` (1 hunks) * `tests/__mocks__/obsidian.ts` (1 hunks) * `tests/basicCoverage.test.ts` (1 hunks) * `tests/converterTypes.test.ts` (1 hunks) * `tests/paperSizeMapper.test.ts` (1 hunks) * `tests/setup.ts` (1 hunks) * `vitest.config.ts` (1 hunks) </details> <details> <summary>✅ Files skipped from review due to trivial changes (2)</summary> * tests/SecurityUtils.test.ts * tests/ModalSettingsHelper.test.ts </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (2)</summary> <details> <summary>package.json</summary> **📄 CodeRabbit inference engine (AGENTS.md)** > Use npm as the package manager (project scripts and deps defined in package.json) Files: - `package.json` </details> <details> <summary>src/**/*.ts</summary> **📄 CodeRabbit inference engine (AGENTS.md)** > `src/**/*.ts`: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts > Add user-facing commands via this.addCommand(...) and use stable command IDs > Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab > Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload > Prefer async/await over promise chains and handle errors gracefully Files: - `src/converters/pandoc/PandocExecutor.ts` - `src/core/ModalSettingsHelper.ts` - `src/core/DependencyChecker.ts` - `src/plugin/EmbedProcessor.ts` - `src/core/SecurityUtils.ts` - `src/converters/PandocTypstConverter.ts` - `src/converters/MarkdownPreprocessor.ts` - `src/converters/PdfToImageConverter.ts` - `src/converters/pandoc/PandocCommandBuilder.ts` - `src/core/settings.ts` - `src/core/PathUtils.ts` - `src/core/TempDirectoryManager.ts` - `src/core/ExportErrorHandler.ts` - `src/core/ExecutableChecker.ts` - `src/core/constants.ts` </details> </details><details> <summary>🧠 Learnings (5)</summary> <details> <summary>📚 Learning: 2025-09-25T14:48:20.040Z</summary> ``` Learnt from: CR Repo: AlexKucera/obsidian-typst-pdf-export PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-09-25T14:48:20.040Z Learning: Applies to esbuild.config.mjs : Use esbuild for bundling (this sample relies on esbuild.config.mjs) ``` **Applied to files:** - `package.json` </details> <details> <summary>📚 Learning: 2025-09-25T14:27:31.837Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/core/PathUtils.ts:108-119 Timestamp: 2025-09-25T14:27:31.837Z Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations. ``` **Applied to files:** - `src/plugin/EmbedProcessor.ts` - `tests/__mocks__/obsidian.ts` - `src/converters/PdfToImageConverter.ts` - `src/core/PathUtils.ts` - `src/core/TempDirectoryManager.ts` - `src/core/ExecutableChecker.ts` - `src/core/constants.ts` </details> <details> <summary>📚 Learning: 2025-09-25T14:14:57.437Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/converters/pandoc/ResourcePathResolver.ts:109-111 Timestamp: 2025-09-25T14:14:57.437Z Learning: In src/converters/pandoc/ResourcePathResolver.ts, the image extension regex /\.(png|jpg|jpeg|gif|svg|webp|bmp|ico|tiff)$/i is intentionally restricted and should not be expanded to include additional formats like .tif, .avif, .heic, .heif as this is a conscious design decision by the maintainer. ``` **Applied to files:** - `src/plugin/EmbedProcessor.ts` - `src/converters/PdfToImageConverter.ts` </details> <details> <summary>📚 Learning: 2025-09-25T14:48:20.040Z</summary> ``` Learnt from: CR Repo: AlexKucera/obsidian-typst-pdf-export PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-09-25T14:48:20.040Z Learning: Applies to src/**/*.ts : Add user-facing commands via this.addCommand(...) and use stable command IDs ``` **Applied to files:** - `src/converters/pandoc/PandocCommandBuilder.ts` </details> <details> <summary>📚 Learning: 2025-09-25T14:48:20.040Z</summary> ``` Learnt from: CR Repo: AlexKucera/obsidian-typst-pdf-export PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-09-25T14:48:20.040Z Learning: Applies to src/**/*.ts : Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab ``` **Applied to files:** - `src/core/settings.ts` </details> </details><details> <summary>🧬 Code graph analysis (14)</summary> <details> <summary>tests/TempDirectoryManager.test.ts (2)</summary><blockquote> <details> <summary>tests/__mocks__/obsidian.ts (1)</summary> * `App` (54-65) </details> <details> <summary>src/core/TempDirectoryManager.ts (1)</summary> * `TempDirectoryManager` (117-453) </details> </blockquote></details> <details> <summary>src/converters/pandoc/PandocExecutor.ts (2)</summary><blockquote> <details> <summary>src/plugin/PathResolver.ts (1)</summary> * `PathResolver` (12-87) </details> <details> <summary>src/converters/converterTypes.ts (1)</summary> * `PandocOptions` (5-30) </details> </blockquote></details> <details> <summary>src/core/ModalSettingsHelper.ts (1)</summary><blockquote> <details> <summary>tests/__mocks__/obsidian.ts (1)</summary> * `TFile` (36-40) </details> </blockquote></details> <details> <summary>tests/paperSizeMapper.test.ts (1)</summary><blockquote> <details> <summary>src/utils/paperSizeMapper.ts (5)</summary> * `SUPPORTED_PAPER_SIZES` (17-58) * `DEFAULT_PAPER_SIZE` (63-63) * `isSupportedPaperSize` (96-98) * `mapToTypstPaperSize` (70-81) * `getValidTypstPaperSizes` (87-89) </details> </blockquote></details> <details> <summary>src/plugin/EmbedProcessor.ts (3)</summary><blockquote> <details> <summary>src/core/PathUtils.ts (1)</summary> * `PathUtils` (29-251) </details> <details> <summary>main.ts (1)</summary> * `obsidianTypstPDFExport` (30-245) </details> <details> <summary>tests/__mocks__/obsidian.ts (1)</summary> * `TFile` (36-40) </details> </blockquote></details> <details> <summary>vitest.config.ts (1)</summary><blockquote> <details> <summary>scripts/package-plugin.js (1)</summary> * `path` (12-12) </details> </blockquote></details> <details> <summary>tests/basicCoverage.test.ts (2)</summary><blockquote> <details> <summary>src/core/constants.ts (4)</summary> * `FALLBACK_FONTS` (52-64) * `PLUGIN_DIRS` (89-93) * `EXPORT_CONSTANTS` (122-128) * `DEPENDENCY_CONSTANTS` (187-252) </details> <details> <summary>src/utils/paperSizeMapper.ts (4)</summary> * `SUPPORTED_PAPER_SIZES` (17-58) * `mapToTypstPaperSize` (70-81) * `isSupportedPaperSize` (96-98) * `DEFAULT_PAPER_SIZE` (63-63) </details> </blockquote></details> <details> <summary>tests/TypstVariableMapper.test.ts (3)</summary><blockquote> <details> <summary>src/core/settings.ts (1)</summary> * `obsidianTypstPDFExportSettings` (75-230) </details> <details> <summary>src/converters/pandoc/TypstVariableMapper.ts (1)</summary> * `TypstVariableMapper` (16-324) </details> <details> <summary>src/converters/converterTypes.ts (1)</summary> * `PandocOptions` (5-30) </details> </blockquote></details> <details> <summary>src/converters/MarkdownPreprocessor.ts (2)</summary><blockquote> <details> <summary>src/converters/preprocessors/WikilinkProcessor.ts (1)</summary> * `PreprocessingResult` (20-58) </details> <details> <summary>src/converters/preprocessors/EmbedProcessor.ts (1)</summary> * `PreprocessingResult` (14-52) </details> </blockquote></details> <details> <summary>src/converters/PdfToImageConverter.ts (2)</summary><blockquote> <details> <summary>main.ts (1)</summary> * `obsidianTypstPDFExport` (30-245) </details> <details> <summary>src/converters/pdf/PdfProcessor.ts (1)</summary> * `PdfProcessor` (19-108) </details> </blockquote></details> <details> <summary>src/converters/pandoc/PandocCommandBuilder.ts (4)</summary><blockquote> <details> <summary>src/converters/pandoc/TypstVariableMapper.ts (1)</summary> * `TypstVariableMapper` (16-324) </details> <details> <summary>src/converters/pandoc/ResourcePathResolver.ts (1)</summary> * `ResourcePathResolver` (8-142) </details> <details> <summary>src/plugin/PathResolver.ts (1)</summary> * `PathResolver` (12-87) </details> <details> <summary>src/converters/converterTypes.ts (1)</summary> * `PandocOptions` (5-30) </details> </blockquote></details> <details> <summary>src/core/PathUtils.ts (1)</summary><blockquote> <details> <summary>tests/__mocks__/obsidian.ts (2)</summary> * `App` (54-65) * `normalizePath` (47-49) </details> </blockquote></details> <details> <summary>src/core/TempDirectoryManager.ts (2)</summary><blockquote> <details> <summary>tests/__mocks__/obsidian.ts (2)</summary> * `App` (54-65) * `normalizePath` (47-49) </details> <details> <summary>src/core/constants.ts (1)</summary> * `PLUGIN_DIRS` (89-93) </details> </blockquote></details> <details> <summary>src/core/ExportErrorHandler.ts (1)</summary><blockquote> <details> <summary>tests/__mocks__/obsidian.ts (1)</summary> * `Notice` (4-6) </details> </blockquote></details> </details> </details> <details> <summary>🔇 Additional comments (6)</summary><blockquote> <details> <summary>tests/TempDirectoryManager.test.ts (1)</summary><blockquote> `1-368`: **LGTM! Comprehensive test coverage.** The test suite thoroughly exercises all public methods of TempDirectoryManager with proper mocking, error handling scenarios, and cross-platform path validation. The tests cover: - Constructor and factory method initialization - Directory path resolution for both 'images' and 'pandoc' types - Directory creation with existence checks - Cleanup operations with file removal and error handling - Path validation for security checks - Windows-style path normalization </blockquote></details> <details> <summary>src/core/settings.ts (1)</summary><blockquote> `1-341`: **LGTM! Excellent settings architecture and documentation.** The settings module provides a well-designed configuration schema with: - Clear separation of concerns (paths, executables, export defaults, typography, page setup, behavior) - Comprehensive JSDoc explaining purpose, usage, and lifecycle of each setting - Sensible defaults that work out-of-the-box - Type safety through TypeScript interfaces and enums - Detailed examples showing how settings are loaded, merged, and used The documentation quality is exceptional and will help future maintainers understand the configuration system. </blockquote></details> <details> <summary>src/core/ModalSettingsHelper.ts (1)</summary><blockquote> `1-279`: **LGTM! Clean API design with excellent documentation.** The ModalSettingsHelper provides a well-structured interface for transforming plugin settings into modal configuration: - Clear separation between single-file and multi-file export preparation - Automatic template variable extraction from plugin settings - Smart handling of multi-file scenarios (count display, file arrays) - Landscape mode width adjustment for single-page exports - Comprehensive JSDoc with multiple usage examples The static method design promotes clean, stateless operation and simplifies testing. </blockquote></details> <details> <summary>src/core/TempDirectoryManager.ts (2)</summary><blockquote> `26-26`: **Node.js 'path' module usage is intentional for cross-platform support.** While past learnings indicate a preference to avoid Node.js built-in modules in favor of Obsidian API calls, the use of the 'path' module here aligns with the PR objectives to resolve Windows path handling issues. The Node.js 'path' module provides robust cross-platform path operations (especially for Windows drive letters and absolute path handling) that complement Obsidian's normalizePath function. Based on learnings --- `1-452`: **Excellent implementation with comprehensive documentation.** The TempDirectoryManager provides robust temporary directory management with: - Cross-platform path handling using Node.js path utilities + Obsidian normalizePath - Automatic directory creation on first use - Safe cleanup preserving directory structure - Security validation to prevent directory traversal - Comprehensive error handling with console warnings rather than exceptions - Well-documented lifecycle and usage patterns The singleton pattern via `static create()` and extensive JSDoc make this class easy to use and maintain. </blockquote></details> <details> <summary>src/converters/PdfToImageConverter.ts (1)</summary><blockquote> `1-631`: **LGTM! Excellent converter architecture with outstanding documentation.** The PdfToImageConverter provides a robust, well-documented singleton for PDF-to-image conversion: **Strengths:** - Clear separation of concerns via delegation to specialized utilities (PdfProcessor, PdfCliExecutor, FileDiscovery, ImageOptimizer) - Proper singleton pattern with plugin reference updates - Comprehensive error handling that returns results rather than throwing exceptions - Detailed JSDoc with multiple usage examples for each method - Well-defined interfaces (PdfConversionOptions, PdfConversionResult) with sensible defaults - Multi-stage pipeline with validation, conversion, discovery, and optimization **Architecture Benefits:** - First-page-only conversion is fast and suitable for preview purposes - Configurable quality/dimensions for different use cases - Error messages preserve context for debugging - Modular design allows easy extension for multi-page conversion - Plugin reference enables vault file operations via PathUtils The documentation quality is exceptional and the implementation is production-ready. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@@ -9,6 +9,8 @@ import type { PreprocessingResult } from '../converters/MarkdownPreprocessor';
import { ExportErrorHandler } from '../core/ExportErrorHandler';
coderabbitai[bot] (Migrated from github.com) commented 2025-11-05 08:19:19 +01:00

⚠️ Potential issue | 🟠 Major

Fix protocol selection for HTTPS URLs.

startsWith('https') is case-sensitive, so uppercase schemes like HTTPS://… will hit the HTTP client. Node’s http.get('HTTPS://...') throws “Protocol "https:" not supported,” and every such remote download fails. Use the parsed URL’s protocol instead so we always call the right module.

-				const protocol = imageUrl.startsWith('https') ? https : http;
+				const protocol = urlObj.protocol === 'https:' ? https : http;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/plugin/EmbedProcessor.ts around lines 108 to 110, the current protocol
selection uses imageUrl.startsWith('https') which is case-sensitive and fails
for uppercase schemes; parse the imageUrl with the URL constructor (e.g., new
URL(imageUrl)), read its .protocol (which will be 'https:' or 'http:'), and pick
the module accordingly (protocol === 'https:' ? https : http); ensure you use
the parsed URL object for the request call so the correct protocol is always
used.

✅ Addressed in commits 1aeebed to 35a5249

_⚠️ Potential issue_ | _🟠 Major_ **Fix protocol selection for HTTPS URLs.** `startsWith('https')` is case-sensitive, so uppercase schemes like `HTTPS://…` will hit the HTTP client. Node’s `http.get('HTTPS://...')` throws “Protocol "https:" not supported,” and every such remote download fails. Use the parsed URL’s protocol instead so we always call the right module. ```diff - const protocol = imageUrl.startsWith('https') ? https : http; + const protocol = urlObj.protocol === 'https:' ? https : http; ``` > Committable suggestion skipped: line range outside the PR's diff. <details> <summary>🤖 Prompt for AI Agents</summary> ``` In src/plugin/EmbedProcessor.ts around lines 108 to 110, the current protocol selection uses imageUrl.startsWith('https') which is case-sensitive and fails for uppercase schemes; parse the imageUrl with the URL constructor (e.g., new URL(imageUrl)), read its .protocol (which will be 'https:' or 'http:'), and pick the module accordingly (protocol === 'https:' ? https : http); ensure you use the parsed URL object for the request call so the correct protocol is always used. ``` </details> <!-- fingerprinting:phantom:medusa:sabertoothed --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits 1aeebed to 35a5249
coderabbitai[bot] (Migrated from github.com) reviewed 2025-11-05 08:43:23 +01:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
src/core/SecurityUtils.ts (1)

219-231: Legitimate Windows executables now fail validation
dangerousPatterns (Line 220) blocks (, ), {, }, [, ], so SecurityUtils.validateExecutablePath("C:\\Program Files (x86)\\Pandoc\\pandoc.exe") now returns false. That is the default installer path on Windows, meaning most users cannot point to Pandoc/Typst/ImageMagick without hitting “Shell metacharacters are not allowed…”. We’re rejecting safe, real-world paths, so this breaks the configuration flow and contradicts the examples right above the method. Please narrow the metacharacter check to characters that are actually dangerous in our spawn usage and rely on the dedicated substitution regexes for $() / ${}. Suggested fix:

-			/[;&|`$(){}[\]]/,  // Shell metacharacters
+			/[;&|`$<>]/,       // Shell metacharacters that can't appear in safe paths

Make the same adjustment in getExecutablePathValidationError (Line 374).

src/core/ExecutableChecker.ts (4)

141-182: Critical: which command doesn't exist on Windows.

The which command (line 148) is Unix-specific and will fail on Windows systems. Windows uses the where command instead. Since this PR specifically addresses Windows path issues, this cross-platform incompatibility is a blocker.

Apply this diff to add platform-specific command selection:

 	private static async findExecutableWithWhich(executableName: string, additionalPaths: string[] = []): Promise<string | null> {
 		const { spawn } = require('child_process');
+		const whichCommand = process.platform === 'win32' ? 'where' : 'which';
 		
 		try {
 			const stdout = await new Promise<string>((resolve, reject) => {
 				const env = this.getAugmentedEnv(additionalPaths);
 				
-				const whichProcess = spawn('which', [executableName], {
+				const whichProcess = spawn(whichCommand, [executableName], {
 					stdio: ['pipe', 'pipe', 'pipe'],
 					env: env
 				});

215-232: Critical: Windows path detection broken.

Line 217 uses includes('/') to detect paths, but Windows paths use backslashes (e.g., C:\Program Files\pandoc\pandoc.exe). This will cause Windows absolute paths to be incorrectly treated as executable names. Since the PR objectives specifically mention "Resolves issues with absolute path handling on Windows," this is a critical regression.

Apply this diff to support both Unix and Windows path separators:

 	public static async resolveExecutablePath(userPath: string | undefined, defaultName: string, additionalPaths: string[] = []): Promise<string> {
-		// If user provided a full path (contains /), use it as-is
-		if (userPath && userPath.trim() !== '' && userPath.includes('/')) {
+		// If user provided a full path (contains / or \), use it as-is
+		if (userPath && userPath.trim() !== '' && (userPath.includes('/') || userPath.includes('\\'))) {
 			return userPath;
 		}

248-277: Critical: Windows path detection and command compatibility issues.

This method has the same two critical Windows compatibility issues:

  1. Line 250: includes('/') won't detect Windows paths with backslashes
  2. Line 260: which command doesn't exist on Windows (needs where instead)

Apply this diff to fix both issues:

 	public static resolveExecutablePathSync(userPath: string | undefined, defaultName: string, additionalPaths: string[] = []): string {
-		// If user provided a full path (contains /), use it as-is
-		if (userPath && userPath.trim() !== '' && userPath.includes('/')) {
+		// If user provided a full path (contains / or \), use it as-is
+		if (userPath && userPath.trim() !== '' && (userPath.includes('/') || userPath.includes('\\'))) {
 			return userPath;
 		}
 		
 		// If user provided just an executable name or empty path, resolve it
 		const searchName = (userPath && userPath.trim() !== '') ? userPath.trim() : defaultName;
 		
 		// Try to find the executable using which command synchronously
 		const { spawnSync } = require('child_process');
+		const whichCommand = process.platform === 'win32' ? 'where' : 'which';
 		try {
-			const result = spawnSync('which', [searchName], {
+			const result = spawnSync(whichCommand, [searchName], {
 				encoding: 'utf8',
 				env: this.getAugmentedEnv(additionalPaths)
 			});

1-402: Now I need to look at how to properly detect absolute paths in a cross-platform way:

Critical Windows compatibility issues require immediate fixes in path detection and executable resolution.

Verification found critical cross-platform problems across multiple files:

  1. Path detection bug (ExecutableChecker.ts lines 195, 258): The code uses userPath.includes('/') to detect absolute paths, but on Windows paths use backslashes; path.isAbsolute() correctly handles Windows drive letters like C:\temp and UNC paths like \\server\share.

  2. which command fails on Windows (ExecutableChecker.ts lines 148, 260; PathResolver.ts line 36): The which command doesn't exist on Windows, making executable resolution completely non-functional for Windows users. The codebase needs a platform-aware approach—either detecting Windows with process.platform === 'win32' or using a cross-platform npm package like cross-spawn.

  3. Inconsistent pattern: PathUtils.ts already has proper cross-platform path detection that should be matched here—it correctly checks for Unix paths (/), Windows drive letters (regex match), and UNC paths (\\).

Replace manual path checks with path.isAbsolute() from the path module (available since Node.js 0.12.0) and implement Windows-aware executable resolution.

src/core/TempDirectoryManager.ts (1)

443-451: Tighten temp dir boundary check

startsWith lets anything prefixed with temp-images (e.g., /temp-images-backup) pass the guard, which defeats the “validation” guarantee and allows operations outside the intended directories. Please require an exact match or ensure the next character is a / so only the real temp folders (and their descendants) are accepted.

-		return normalizedDirPath.startsWith(tempImagesDir) ||
-		       normalizedDirPath.startsWith(tempPandocDir);
+		const isImagesDir =
+			normalizedDirPath === tempImagesDir ||
+			normalizedDirPath.startsWith(`${tempImagesDir}/`);
+		const isPandocDir =
+			normalizedDirPath === tempPandocDir ||
+			normalizedDirPath.startsWith(`${tempPandocDir}/`);
+
+		return isImagesDir || isPandocDir;
🧹 Nitpick comments (1)
src/core/ExecutableChecker.ts (1)

312-369: LGTM: Secure and robust dependency checking.

The use of spawn with separated arguments (line 323) properly prevents command injection. Error handling and return structure are well-designed.

For edge cases where version commands might contain quoted arguments, consider parsing the command more carefully than simple space splitting. However, for typical version flags like --version, the current implementation is sufficient.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4eb52d11c0 and 35a5249607.

📒 Files selected for processing (5)
  • src/converters/PandocTypstConverter.ts (8 hunks)
  • src/core/ExecutableChecker.ts (7 hunks)
  • src/core/SecurityUtils.ts (4 hunks)
  • src/core/TempDirectoryManager.ts (6 hunks)
  • src/plugin/EmbedProcessor.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts
Add user-facing commands via this.addCommand(...) and use stable command IDs
Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab
Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload
Prefer async/await over promise chains and handle errors gracefully

Files:

  • src/plugin/EmbedProcessor.ts
  • src/core/TempDirectoryManager.ts
  • src/converters/PandocTypstConverter.ts
  • src/core/ExecutableChecker.ts
  • src/core/SecurityUtils.ts
🧠 Learnings (2)
📚 Learning: 2025-09-25T14:27:31.837Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/core/PathUtils.ts:108-119
Timestamp: 2025-09-25T14:27:31.837Z
Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations.

Applied to files:

  • src/plugin/EmbedProcessor.ts
  • src/core/TempDirectoryManager.ts
  • src/core/ExecutableChecker.ts
📚 Learning: 2025-09-25T14:14:57.437Z
Learnt from: AlexKucera
Repo: AlexKucera/obsidian-typst-pdf-export PR: 5
File: src/converters/pandoc/ResourcePathResolver.ts:109-111
Timestamp: 2025-09-25T14:14:57.437Z
Learning: In src/converters/pandoc/ResourcePathResolver.ts, the image extension regex /\.(png|jpg|jpeg|gif|svg|webp|bmp|ico|tiff)$/i is intentionally restricted and should not be expanded to include additional formats like .tif, .avif, .heic, .heif as this is a conscious design decision by the maintainer.

Applied to files:

  • src/plugin/EmbedProcessor.ts
🧬 Code graph analysis (4)
src/plugin/EmbedProcessor.ts (3)
src/converters/preprocessors/EmbedProcessor.ts (1)
  • EmbedProcessor (54-244)
src/core/PathUtils.ts (1)
  • PathUtils (29-251)
main.ts (1)
  • obsidianTypstPDFExport (30-245)
src/core/TempDirectoryManager.ts (2)
tests/__mocks__/obsidian.ts (2)
  • App (54-65)
  • normalizePath (47-49)
src/core/constants.ts (1)
  • PLUGIN_DIRS (89-93)
src/converters/PandocTypstConverter.ts (2)
src/converters/pandoc/PandocCommandBuilder.ts (1)
  • PandocCommandBuilder (96-398)
src/converters/pandoc/PandocExecutor.ts (1)
  • PandocExecutor (61-415)
src/core/ExecutableChecker.ts (1)
src/core/constants.ts (1)
  • DEPENDENCY_CONSTANTS (187-252)
🔇 Additional comments (3)
src/core/ExecutableChecker.ts (3)

83-103: LGTM: Solid cross-platform PATH augmentation.

The platform-specific delimiter handling and empty segment filtering are well-implemented. The method correctly combines system paths with user-provided additional paths.


116-121: LGTM: Clean environment builder.

Simple and correct implementation that properly augments the environment with extended PATH.


390-402: LGTM: Appropriate synchronous availability check.

The simplified boolean return is well-suited for quick initialization checks. Implementation mirrors the async version appropriately.

**Actionable comments posted: 0** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to platform limitations. > > > > <details> > <summary>⚠️ Outside diff range comments (6)</summary><blockquote> > > <details> > <summary>src/core/SecurityUtils.ts (1)</summary><blockquote> > > `219-231`: **Legitimate Windows executables now fail validation** > `dangerousPatterns` (Line 220) blocks `(`, `)`, `{`, `}`, `[`, `]`, so `SecurityUtils.validateExecutablePath("C:\\Program Files (x86)\\Pandoc\\pandoc.exe")` now returns false. That is the default installer path on Windows, meaning most users cannot point to Pandoc/Typst/ImageMagick without hitting “Shell metacharacters are not allowed…”. We’re rejecting safe, real-world paths, so this breaks the configuration flow and contradicts the examples right above the method. Please narrow the metacharacter check to characters that are actually dangerous in our spawn usage and rely on the dedicated substitution regexes for `$()` / `${}`. Suggested fix: > > ```diff > - /[;&|`$(){}[\]]/, // Shell metacharacters > + /[;&|`$<>]/, // Shell metacharacters that can't appear in safe paths > ``` > > Make the same adjustment in `getExecutablePathValidationError` (Line 374). > > </blockquote></details> > <details> > <summary>src/core/ExecutableChecker.ts (4)</summary><blockquote> > > `141-182`: **Critical: `which` command doesn't exist on Windows.** > > The `which` command (line 148) is Unix-specific and will fail on Windows systems. Windows uses the `where` command instead. Since this PR specifically addresses Windows path issues, this cross-platform incompatibility is a blocker. > > > > Apply this diff to add platform-specific command selection: > > ```diff > private static async findExecutableWithWhich(executableName: string, additionalPaths: string[] = []): Promise<string | null> { > const { spawn } = require('child_process'); > + const whichCommand = process.platform === 'win32' ? 'where' : 'which'; > > try { > const stdout = await new Promise<string>((resolve, reject) => { > const env = this.getAugmentedEnv(additionalPaths); > > - const whichProcess = spawn('which', [executableName], { > + const whichProcess = spawn(whichCommand, [executableName], { > stdio: ['pipe', 'pipe', 'pipe'], > env: env > }); > ``` > > --- > > `215-232`: **Critical: Windows path detection broken.** > > Line 217 uses `includes('/')` to detect paths, but Windows paths use backslashes (e.g., `C:\Program Files\pandoc\pandoc.exe`). This will cause Windows absolute paths to be incorrectly treated as executable names. Since the PR objectives specifically mention "Resolves issues with absolute path handling on Windows," this is a critical regression. > > > > Apply this diff to support both Unix and Windows path separators: > > ```diff > public static async resolveExecutablePath(userPath: string | undefined, defaultName: string, additionalPaths: string[] = []): Promise<string> { > - // If user provided a full path (contains /), use it as-is > - if (userPath && userPath.trim() !== '' && userPath.includes('/')) { > + // If user provided a full path (contains / or \), use it as-is > + if (userPath && userPath.trim() !== '' && (userPath.includes('/') || userPath.includes('\\'))) { > return userPath; > } > ``` > > --- > > `248-277`: **Critical: Windows path detection and command compatibility issues.** > > This method has the same two critical Windows compatibility issues: > > 1. Line 250: `includes('/')` won't detect Windows paths with backslashes > 2. Line 260: `which` command doesn't exist on Windows (needs `where` instead) > > > > Apply this diff to fix both issues: > > ```diff > public static resolveExecutablePathSync(userPath: string | undefined, defaultName: string, additionalPaths: string[] = []): string { > - // If user provided a full path (contains /), use it as-is > - if (userPath && userPath.trim() !== '' && userPath.includes('/')) { > + // If user provided a full path (contains / or \), use it as-is > + if (userPath && userPath.trim() !== '' && (userPath.includes('/') || userPath.includes('\\'))) { > return userPath; > } > > // If user provided just an executable name or empty path, resolve it > const searchName = (userPath && userPath.trim() !== '') ? userPath.trim() : defaultName; > > // Try to find the executable using which command synchronously > const { spawnSync } = require('child_process'); > + const whichCommand = process.platform === 'win32' ? 'where' : 'which'; > try { > - const result = spawnSync('which', [searchName], { > + const result = spawnSync(whichCommand, [searchName], { > encoding: 'utf8', > env: this.getAugmentedEnv(additionalPaths) > }); > ``` > > --- > > `1-402`: Now I need to look at how to properly detect absolute paths in a cross-platform way: > > **Critical Windows compatibility issues require immediate fixes in path detection and executable resolution.** > > Verification found critical cross-platform problems across multiple files: > > 1. **Path detection bug (ExecutableChecker.ts lines 195, 258)**: The code uses `userPath.includes('/')` to detect absolute paths, but on Windows paths use backslashes; `path.isAbsolute()` correctly handles Windows drive letters like `C:\temp` and UNC paths like `\\server\share`. > > 2. **`which` command fails on Windows (ExecutableChecker.ts lines 148, 260; PathResolver.ts line 36)**: The `which` command doesn't exist on Windows, making executable resolution completely non-functional for Windows users. The codebase needs a platform-aware approach—either detecting Windows with `process.platform === 'win32'` or using a cross-platform npm package like `cross-spawn`. > > 3. **Inconsistent pattern**: PathUtils.ts already has proper cross-platform path detection that should be matched here—it correctly checks for Unix paths (`/`), Windows drive letters (regex match), and UNC paths (`\\`). > > Replace manual path checks with `path.isAbsolute()` from the path module (available since Node.js 0.12.0) and implement Windows-aware executable resolution. > > </blockquote></details> > <details> > <summary>src/core/TempDirectoryManager.ts (1)</summary><blockquote> > > `443-451`: **Tighten temp dir boundary check** > > `startsWith` lets anything prefixed with `temp-images` (e.g., `/temp-images-backup`) pass the guard, which defeats the “validation” guarantee and allows operations outside the intended directories. Please require an exact match or ensure the next character is a `/` so only the real temp folders (and their descendants) are accepted. > > ```diff > - return normalizedDirPath.startsWith(tempImagesDir) || > - normalizedDirPath.startsWith(tempPandocDir); > + const isImagesDir = > + normalizedDirPath === tempImagesDir || > + normalizedDirPath.startsWith(`${tempImagesDir}/`); > + const isPandocDir = > + normalizedDirPath === tempPandocDir || > + normalizedDirPath.startsWith(`${tempPandocDir}/`); > + > + return isImagesDir || isPandocDir; > ``` > > </blockquote></details> > > </blockquote></details> <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>src/core/ExecutableChecker.ts (1)</summary><blockquote> `312-369`: **LGTM: Secure and robust dependency checking.** The use of `spawn` with separated arguments (line 323) properly prevents command injection. Error handling and return structure are well-designed. For edge cases where version commands might contain quoted arguments, consider parsing the command more carefully than simple space splitting. However, for typical version flags like `--version`, the current implementation is sufficient. </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4eb52d11c002c4b89b40e35fa3a8b947e1d14f9a and 35a5249607720ad86047bd14021a9833f5777318. </details> <details> <summary>📒 Files selected for processing (5)</summary> * `src/converters/PandocTypstConverter.ts` (8 hunks) * `src/core/ExecutableChecker.ts` (7 hunks) * `src/core/SecurityUtils.ts` (4 hunks) * `src/core/TempDirectoryManager.ts` (6 hunks) * `src/plugin/EmbedProcessor.ts` (4 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (1)</summary> <details> <summary>src/**/*.ts</summary> **📄 CodeRabbit inference engine (AGENTS.md)** > `src/**/*.ts`: Organize code into multiple files under src/ (commands/, ui/, utils/, etc.) rather than putting everything in main.ts > Add user-facing commands via this.addCommand(...) and use stable command IDs > Persist settings using this.loadData()/this.saveData() and provide sensible defaults via a settings tab > Register and clean up all DOM, app, and interval listeners using this.register* helpers for safe unload > Prefer async/await over promise chains and handle errors gracefully Files: - `src/plugin/EmbedProcessor.ts` - `src/core/TempDirectoryManager.ts` - `src/converters/PandocTypstConverter.ts` - `src/core/ExecutableChecker.ts` - `src/core/SecurityUtils.ts` </details> </details><details> <summary>🧠 Learnings (2)</summary> <details> <summary>📚 Learning: 2025-09-25T14:27:31.837Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/core/PathUtils.ts:108-119 Timestamp: 2025-09-25T14:27:31.837Z Learning: The obsidian-typst-pdf-export plugin prefers to avoid Node.js built-in modules like 'path' and instead stick to Obsidian API calls for path operations. ``` **Applied to files:** - `src/plugin/EmbedProcessor.ts` - `src/core/TempDirectoryManager.ts` - `src/core/ExecutableChecker.ts` </details> <details> <summary>📚 Learning: 2025-09-25T14:14:57.437Z</summary> ``` Learnt from: AlexKucera Repo: AlexKucera/obsidian-typst-pdf-export PR: 5 File: src/converters/pandoc/ResourcePathResolver.ts:109-111 Timestamp: 2025-09-25T14:14:57.437Z Learning: In src/converters/pandoc/ResourcePathResolver.ts, the image extension regex /\.(png|jpg|jpeg|gif|svg|webp|bmp|ico|tiff)$/i is intentionally restricted and should not be expanded to include additional formats like .tif, .avif, .heic, .heif as this is a conscious design decision by the maintainer. ``` **Applied to files:** - `src/plugin/EmbedProcessor.ts` </details> </details><details> <summary>🧬 Code graph analysis (4)</summary> <details> <summary>src/plugin/EmbedProcessor.ts (3)</summary><blockquote> <details> <summary>src/converters/preprocessors/EmbedProcessor.ts (1)</summary> * `EmbedProcessor` (54-244) </details> <details> <summary>src/core/PathUtils.ts (1)</summary> * `PathUtils` (29-251) </details> <details> <summary>main.ts (1)</summary> * `obsidianTypstPDFExport` (30-245) </details> </blockquote></details> <details> <summary>src/core/TempDirectoryManager.ts (2)</summary><blockquote> <details> <summary>tests/__mocks__/obsidian.ts (2)</summary> * `App` (54-65) * `normalizePath` (47-49) </details> <details> <summary>src/core/constants.ts (1)</summary> * `PLUGIN_DIRS` (89-93) </details> </blockquote></details> <details> <summary>src/converters/PandocTypstConverter.ts (2)</summary><blockquote> <details> <summary>src/converters/pandoc/PandocCommandBuilder.ts (1)</summary> * `PandocCommandBuilder` (96-398) </details> <details> <summary>src/converters/pandoc/PandocExecutor.ts (1)</summary> * `PandocExecutor` (61-415) </details> </blockquote></details> <details> <summary>src/core/ExecutableChecker.ts (1)</summary><blockquote> <details> <summary>src/core/constants.ts (1)</summary> * `DEPENDENCY_CONSTANTS` (187-252) </details> </blockquote></details> </details> </details> <details> <summary>🔇 Additional comments (3)</summary><blockquote> <details> <summary>src/core/ExecutableChecker.ts (3)</summary><blockquote> `83-103`: **LGTM: Solid cross-platform PATH augmentation.** The platform-specific delimiter handling and empty segment filtering are well-implemented. The method correctly combines system paths with user-provided additional paths. --- `116-121`: **LGTM: Clean environment builder.** Simple and correct implementation that properly augments the environment with extended PATH. --- `390-402`: **LGTM: Appropriate synchronous availability check.** The simplified boolean return is well-suited for quick initialization checks. Implementation mirrors the async version appropriately. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Sign in to join this conversation.