Fixes path handling and adds remote image support
Addresses issues with path construction on Windows by using `path.isAbsolute()` to correctly handle absolute paths. Improves cross-platform compatibility in temp directory management and binary location. Adds support for downloading and embedding remote images (http/https URLs) in markdown, enhancing content integration. Provides fallback mechanism with placeholder text upon download failure.
This commit is contained in:
6 files changed
+263
-37
No files matched your search
@@ -131,13 +131,16 @@ export class BinaryLocator {
|
||||
* @returns Array of possible plugin directory paths
|
||||
*/
|
||||
private static getPossiblePluginDirs(plugin: obsidianTypstPDFExport | undefined, pluginDirName: string, configDir: string): string[] {
|
||||
const pathUtils = plugin ? new PathUtils(plugin.app) : null;
|
||||
|
||||
return [
|
||||
// Strategy 1: From process.cwd() if it's in the vault
|
||||
path.join(process.cwd(), configDir, 'plugins', pluginDirName),
|
||||
// Strategy 2: Assuming we're running from vault root
|
||||
path.join(configDir, 'plugins', pluginDirName),
|
||||
// Strategy 3: From vault base path if plugin is available
|
||||
...(plugin ? [path.join(new PathUtils(plugin.app).getVaultPath(), plugin.manifest.dir!)] : [])
|
||||
// Use PathUtils.joinPath to handle absolute paths correctly on Windows
|
||||
...(pathUtils ? [pathUtils.joinPath(pathUtils.getVaultPath(), plugin!.manifest.dir!)] : [])
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user