Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38fca744cd | ||
|
|
56ab1ae320 | ||
|
|
5519c98957 |
No files matched your search
@@ -5,6 +5,14 @@ All notable changes to the Obsidian Typst PDF Export plugin will be documented i
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.0.1]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **Dynamic Path Resolution**: Fixed font caching, template loading, and temp directory paths to use dynamic plugin directory resolution instead of hardcoded "obsidian-typst-pdf-export" paths
|
||||||
|
- **Plugin Directory Detection**: Updated PdfToImageConverter to dynamically detect plugin directory name from manifest
|
||||||
|
- **Template Manager Paths**: Fixed template directory path resolution to work with renamed plugin folder
|
||||||
|
- **Documentation**: Updated README.md to reflect correct folder name "typst-pdf-export" in all installation instructions
|
||||||
|
|
||||||
## [1.0.0]
|
## [1.0.0]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ Typst offers several advantages over standard PDF export:
|
|||||||
**⚠️ Important**: This plugin requires template files to function. Always use the complete ZIP package.
|
**⚠️ Important**: This plugin requires template files to function. Always use the complete ZIP package.
|
||||||
|
|
||||||
1. Go to [GitHub Releases](https://github.com/akucera/obsidian-typst-pdf-export/releases)
|
1. Go to [GitHub Releases](https://github.com/akucera/obsidian-typst-pdf-export/releases)
|
||||||
2. Download the **complete ZIP package** (`obsidian-typst-pdf-export.zip`) - **NOT just main.js**
|
2. Download the **complete ZIP package** (`typst-pdf-export.zip`) - **NOT just main.js**
|
||||||
3. Extract the entire contents to `{VaultFolder}/.obsidian/plugins/obsidian-typst-pdf-export/`
|
3. Extract the entire contents to `{VaultFolder}/.obsidian/plugins/typst-pdf-export/`
|
||||||
4. Ensure the `templates/` directory is included with all `.typ` files:
|
4. Ensure the `templates/` directory is included with all `.typ` files:
|
||||||
```
|
```
|
||||||
.obsidian/plugins/obsidian-typst-pdf-export/
|
.obsidian/plugins/typst-pdf-export/
|
||||||
├── main.js
|
├── main.js
|
||||||
├── manifest.json
|
├── manifest.json
|
||||||
├── styles.css
|
├── styles.css
|
||||||
@@ -90,8 +90,8 @@ For development or the latest changes:
|
|||||||
1. Clone the repository to your vault's plugins folder:
|
1. Clone the repository to your vault's plugins folder:
|
||||||
```bash
|
```bash
|
||||||
cd {VaultFolder}/.obsidian/plugins/
|
cd {VaultFolder}/.obsidian/plugins/
|
||||||
git clone https://github.com/akucera/obsidian-typst-pdf-export.git
|
git clone https://github.com/akucera/obsidian-typst-pdf-export.git typst-pdf-export
|
||||||
cd obsidian-typst-pdf-export
|
cd typst-pdf-export
|
||||||
```
|
```
|
||||||
2. Install dependencies and build:
|
2. Install dependencies and build:
|
||||||
```bash
|
```bash
|
||||||
@@ -268,8 +268,8 @@ JB
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
git clone https://github.com/akucera/obsidian-typst-pdf-export.git
|
git clone https://github.com/akucera/obsidian-typst-pdf-export.git typst-pdf-export
|
||||||
cd obsidian-typst-pdf-export
|
cd typst-pdf-export
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
npm install
|
npm install
|
||||||
@@ -281,7 +281,7 @@ npm run dev
|
|||||||
### Project Structure
|
### Project Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
obsidian-typst-pdf-export/
|
typst-pdf-export/
|
||||||
├── src/
|
├── src/
|
||||||
│ ├── core/ # Core system components
|
│ ├── core/ # Core system components
|
||||||
│ ├── converters/ # Conversion pipeline
|
│ ├── converters/ # Conversion pipeline
|
||||||
|
|||||||
@@ -155,7 +155,8 @@ export class obsidianTypstPDFExport extends Plugin {
|
|||||||
typstPath: typstPath
|
typstPath: typstPath
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.app.vault.adapter.write('.obsidian/plugins/typst-pdf-export/fonts-cache.json',
|
const fontsCachePath = path.join(this.manifest.dir!, 'fonts-cache.json');
|
||||||
|
await this.app.vault.adapter.write(fontsCachePath,
|
||||||
JSON.stringify(cacheData, null, 2));
|
JSON.stringify(cacheData, null, 2));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to cache fonts from typst:', error);
|
console.error('Failed to cache fonts from typst:', error);
|
||||||
@@ -178,7 +179,8 @@ export class obsidianTypstPDFExport extends Plugin {
|
|||||||
error: error.message
|
error: error.message
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.app.vault.adapter.write('.obsidian/plugins/typst-pdf-export/fonts-cache.json',
|
const fontsCachePath = path.join(this.manifest.dir!, 'fonts-cache.json');
|
||||||
|
await this.app.vault.adapter.write(fontsCachePath,
|
||||||
JSON.stringify(cacheData, null, 2));
|
JSON.stringify(cacheData, null, 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,7 +190,8 @@ export class obsidianTypstPDFExport extends Plugin {
|
|||||||
*/
|
*/
|
||||||
async getCachedFonts(): Promise<string[]> {
|
async getCachedFonts(): Promise<string[]> {
|
||||||
try {
|
try {
|
||||||
const cacheContent = await this.app.vault.adapter.read('.obsidian/plugins/typst-pdf-export/fonts-cache.json');
|
const fontsCachePath = path.join(this.manifest.dir!, 'fonts-cache.json');
|
||||||
|
const cacheContent = await this.app.vault.adapter.read(fontsCachePath);
|
||||||
const cacheData = JSON.parse(cacheContent);
|
const cacheData = JSON.parse(cacheContent);
|
||||||
|
|
||||||
// Check if cache is older than 24 hours or typst path changed
|
// Check if cache is older than 24 hours or typst path changed
|
||||||
@@ -776,7 +779,7 @@ ${dependencyResult.allAvailable
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
// Copy image to vault temp directory for access
|
// Copy image to vault temp directory for access
|
||||||
const vaultTempImagesDir = pathModule.join(vaultBasePath, '.obsidian', 'plugins', 'typst-pdf-export', 'temp-images');
|
const vaultTempImagesDir = pathModule.join(vaultBasePath, this.manifest.dir!, 'temp-images');
|
||||||
await fs.promises.mkdir(vaultTempImagesDir, { recursive: true });
|
await fs.promises.mkdir(vaultTempImagesDir, { recursive: true });
|
||||||
|
|
||||||
// Sanitize the basename for use in filename - replace problematic characters
|
// Sanitize the basename for use in filename - replace problematic characters
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "typst-pdf-export",
|
"id": "typst-pdf-export",
|
||||||
"name": "Typst PDF Export",
|
"name": "Typst PDF Export",
|
||||||
"version": "1.0.0",
|
"version": "1.0.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.0.0",
|
"version": "1.0.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": {
|
||||||
|
|||||||
@@ -128,13 +128,14 @@ export class PdfToImageConverter {
|
|||||||
let pluginDir: string;
|
let pluginDir: string;
|
||||||
|
|
||||||
// Try multiple strategies to find the plugin directory
|
// Try multiple strategies to find the plugin directory
|
||||||
|
const pluginDirName = this.plugin?.manifest?.dir || 'typst-pdf-export';
|
||||||
const possiblePluginDirs = [
|
const possiblePluginDirs = [
|
||||||
// Strategy 1: From process.cwd() if it's in the vault
|
// Strategy 1: From process.cwd() if it's in the vault
|
||||||
path.join(process.cwd(), '.obsidian', 'plugins', 'typst-pdf-export'),
|
path.join(process.cwd(), '.obsidian', 'plugins', pluginDirName),
|
||||||
// Strategy 2: Assuming we're running from vault root
|
// Strategy 2: Assuming we're running from vault root
|
||||||
path.join('.obsidian', 'plugins', 'typst-pdf-export'),
|
path.join('.obsidian', 'plugins', pluginDirName),
|
||||||
// Strategy 3: Direct path if running in development
|
// Strategy 3: From vault base path if plugin is available
|
||||||
'/Users/alex/Obsidian/Dev/.obsidian/plugins/typst-pdf-export'
|
...(this.plugin ? [path.join((this.plugin.app.vault.adapter as any).basePath, this.plugin.manifest.dir!)] : [])
|
||||||
];
|
];
|
||||||
|
|
||||||
// Find the first directory that exists and has node_modules
|
// Find the first directory that exists and has node_modules
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ export class TemplateManager {
|
|||||||
// Templates are stored in the plugin directory
|
// Templates are stored in the plugin directory
|
||||||
this.templatesPath = path.join(
|
this.templatesPath = path.join(
|
||||||
(this.plugin.app.vault.adapter as any).basePath,
|
(this.plugin.app.vault.adapter as any).basePath,
|
||||||
'.obsidian/plugins/typst-pdf-export/templates'
|
this.plugin.manifest.dir!,
|
||||||
|
'templates'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"1.0.0": "1.9.12"
|
"1.0.0": "1.9.12",
|
||||||
|
"1.0.1": "1.9.12"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user