Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62738c35b2 | ||
|
|
cf4de4ce36 |
No files matched your search
@@ -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
@@ -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
@@ -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": {
|
||||||
|
|||||||
@@ -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
@@ -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"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user