2 Commits
Author SHA1 Message Date
Jarvis 62738c35b2 chore: release 1.4.1
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 22:21:19 +01:00
Jarvis cf4de4ce36 fix: normalize Windows paths to forward slashes for Typst
Fixes Windows "syntax error" (OS error 123) when template paths
contain backslashes. Typst interprets backslashes as escape
characters, causing invalid filename syntax errors.

Now converts all template paths to use forward slashes before
passing to Typst via variables. Typst accepts forward slashes
on all platforms including Windows.

Fixes: #10

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 22:20:23 +01:00
5 changed files with 39 additions and 29 deletions

No files matched your search

+5
View File
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.4.1] - 2025-01-09
### Fixed
- Windows path handling in Typst template variables - backslashes now normalized to forward slashes to prevent Typst syntax errors (OS error 123: "The syntax for the filename, directory name or volume label is incorrect")
## [1.4.0] - 2025-01-09 ## [1.4.0] - 2025-01-09
### Added ### Added
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"id": "typst-pdf-export", "id": "typst-pdf-export",
"name": "Typst PDF Export", "name": "Typst PDF Export",
"version": "1.4.0", "version": "1.4.1",
"minAppVersion": "1.9.12", "minAppVersion": "1.9.12",
"description": "Exports a note or collection of notes to a pretty Typst PDF.", "description": "Exports a note or collection of notes to a pretty Typst PDF.",
"author": "Alexander Kucera", "author": "Alexander Kucera",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "obsidian-typst-pdf-export", "name": "obsidian-typst-pdf-export",
"version": "1.4.0", "version": "1.4.1",
"description": "Exports a note or collection of notes to a pretty Typst PDF.", "description": "Exports a note or collection of notes to a pretty Typst PDF.",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
+30 -26
View File
@@ -285,35 +285,39 @@ export class PandocCommandBuilder {
* @private * @private
*/ */
private async addTemplateConfiguration(args: string[], pandocOptions: PandocOptions): Promise<void> { private async addTemplateConfiguration(args: string[], pandocOptions: PandocOptions): Promise<void> {
// Use universal wrapper with --template and pass actual template as template_path variable // Use universal wrapper with --template and pass actual template as template_path variable
if (pandocOptions.template) { if (pandocOptions.template) {
const pathUtils = new PathUtils(this.plugin.app); const pathUtils = new PathUtils(this.plugin.app);
const absolutePluginDir = pandocOptions.pluginDir || ''; const absolutePluginDir = pandocOptions.pluginDir || '';
const wrapperPath = pathUtils.joinPath(absolutePluginDir, 'templates', 'universal-wrapper.pandoc.typ'); const wrapperPath = pathUtils.joinPath(absolutePluginDir, 'templates', 'universal-wrapper.pandoc.typ');
// Verify wrapper exists // Verify wrapper exists
if (!(await pathUtils.fileExists(wrapperPath))) { if (!(await pathUtils.fileExists(wrapperPath))) {
throw new Error(`Universal wrapper template not found at: ${wrapperPath}`); throw new Error(`Universal wrapper template not found at: ${wrapperPath}`);
}
args.push('--template', wrapperPath);
// Add plugin templates directory as a resource path so Typst can find template files
const templatesDir = pathUtils.joinPath(absolutePluginDir, 'templates');
// Path quoting handled automatically by spawn
args.push('--resource-path', templatesDir);
// Pass the actual template path as a variable
// Use relative path from vault root for Typst import
let templatePathForTypst = pandocOptions.template;
if (path.isAbsolute(templatePathForTypst) && pandocOptions.vaultBasePath) {
// Make template path relative to vault for Typst import
templatePathForTypst = path.relative(pandocOptions.vaultBasePath, templatePathForTypst);
}
args.push('-V', `template_path=${templatePathForTypst}`);
} }
args.push('--template', wrapperPath);
// Add plugin templates directory as a resource path so Typst can find template files
const templatesDir = pathUtils.joinPath(absolutePluginDir, 'templates');
// Path quoting handled automatically by spawn
args.push('--resource-path', templatesDir);
// Pass the actual template path as a variable
// Use relative path from vault root for Typst import
let templatePathForTypst = pandocOptions.template;
if (path.isAbsolute(templatePathForTypst) && pandocOptions.vaultBasePath) {
// Make template path relative to vault for Typst import
templatePathForTypst = path.relative(pandocOptions.vaultBasePath, templatePathForTypst);
}
// Normalize to forward slashes for Typst (Typst uses forward slashes on all platforms)
// This prevents Windows backslashes from being interpreted as escape characters in Typst
templatePathForTypst = templatePathForTypst.replace(/\\/g, '/');
args.push('-V', `template_path=${templatePathForTypst}`);
} }
}
/** /**
* Adds all Typst template variables mapped from export configuration. * Adds all Typst template variables mapped from export configuration.
+2 -1
View File
@@ -6,5 +6,6 @@
"1.2.1": "1.9.12", "1.2.1": "1.9.12",
"1.3.0": "1.9.12", "1.3.0": "1.9.12",
"1.3.1": "1.9.12", "1.3.1": "1.9.12",
"1.4.0": "1.9.12" "1.4.0": "1.9.12",
"1.4.1": "1.9.12"
} }