Improves Typst error reporting in Pandoc conversion
Replaces intermediate Typst file generation with enhanced diagnostic options Adds short diagnostic format for better error reporting during Typst PDF engine conversion Removes complex intermediate file generation and debug file copying logic Simplifies command builder by focusing on diagnostic improvements
This commit is contained in:
2 files changed
+6
-31
No files matched your search
@@ -60,8 +60,8 @@ export class PandocCommandBuilder {
|
|||||||
// Add Typst engine options
|
// Add Typst engine options
|
||||||
this.addTypstEngineOptions(args, pandocOptions);
|
this.addTypstEngineOptions(args, pandocOptions);
|
||||||
|
|
||||||
// Generate intermediate Typst file if requested
|
// Add enhanced Typst diagnostics for better error reporting
|
||||||
await this.addIntermediateTypstOutput(args, pandocOptions);
|
this.addTypstDiagnostics(args, pandocOptions);
|
||||||
|
|
||||||
// Set working directory for relative paths
|
// Set working directory for relative paths
|
||||||
if (pandocOptions.vaultBasePath) {
|
if (pandocOptions.vaultBasePath) {
|
||||||
@@ -147,32 +147,11 @@ export class PandocCommandBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate intermediate Typst file if requested
|
* Add enhanced Typst diagnostics for better error reporting
|
||||||
*/
|
*/
|
||||||
private async addIntermediateTypstOutput(args: string[], pandocOptions: PandocOptions): Promise<void> {
|
private addTypstDiagnostics(args: string[], pandocOptions: PandocOptions): void {
|
||||||
if (!pandocOptions.generateIntermediateTypst || !pandocOptions.tempDir) {
|
// Add Typst diagnostic options for better error reporting
|
||||||
return;
|
args.push('--pdf-engine-opt', '--diagnostic-format=short');
|
||||||
}
|
|
||||||
|
|
||||||
const typstPath = path.join(pandocOptions.tempDir, 'intermediate.typ');
|
|
||||||
args.push('--output', typstPath);
|
|
||||||
|
|
||||||
// Also create a copy to keep for debugging
|
|
||||||
const debugTypstPath = path.join(pandocOptions.tempDir, 'debug.typ');
|
|
||||||
// Store cleanup handler in pandocOptions to be handled by the caller
|
|
||||||
if (!pandocOptions.cleanupHandlers) {
|
|
||||||
pandocOptions.cleanupHandlers = [];
|
|
||||||
}
|
|
||||||
pandocOptions.cleanupHandlers.push(() => {
|
|
||||||
try {
|
|
||||||
const fs = require('fs');
|
|
||||||
if (fs.existsSync(typstPath)) {
|
|
||||||
fs.copyFileSync(typstPath, debugTypstPath);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.warn('Could not create debug Typst file:', e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -30,10 +30,6 @@ export class PandocExecutor {
|
|||||||
const pandocPath = this.pathResolver.resolveExecutablePath(pandocOptions.pandocPath, 'pandoc');
|
const pandocPath = this.pathResolver.resolveExecutablePath(pandocOptions.pandocPath, 'pandoc');
|
||||||
const timeout = pandocOptions.timeout || 60000;
|
const timeout = pandocOptions.timeout || 60000;
|
||||||
|
|
||||||
// Log the exact command being executed for debugging
|
|
||||||
|
|
||||||
progressCallback?.('Starting Pandoc process...', 40);
|
|
||||||
|
|
||||||
// Determine working directory - use vault base path if available, fallback to plugin directory
|
// Determine working directory - use vault base path if available, fallback to plugin directory
|
||||||
let workingDir: string;
|
let workingDir: string;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user