Adds README and funding URLs to manifest
Adds a comprehensive README file detailing the plugin's features, installation, usage, and development. Includes funding URLs in the manifest to allow users to support the project.
This commit is contained in:
2 files changed
+284
-68
No files matched your search
@@ -1,94 +1,305 @@
|
|||||||
# Obsidian Sample Plugin
|
# Obsidian Typst PDF Export
|
||||||
|
|
||||||
This is a sample plugin for Obsidian (https://obsidian.md).
|
[](https://github.com/akucera/obsidian-typst-pdf-export/releases)
|
||||||
|
[](https://opensource.org/licenses/MIT)
|
||||||
|
[](https://obsidian.md/plugins?id=obsidian-typst-pdf-export)
|
||||||
|
|
||||||
This project uses TypeScript to provide type checking and documentation.
|
Transform your Obsidian notes into beautiful, professionally-typeset PDFs using the powerful Typst typesetting system. This plugin provides a complete PDF export solution with customizable templates, advanced formatting options, and batch processing capabilities.
|
||||||
The repo depends on the latest plugin API (obsidian.d.ts) in TypeScript Definition format, which contains TSDoc comments describing what it does.
|
|
||||||
|
|
||||||
This sample plugin demonstrates some of the basic functionality the plugin API can do.
|
## 📖 Table of Contents
|
||||||
- Adds a ribbon icon, which shows a Notice when clicked.
|
|
||||||
- Adds a command "Open Sample Modal" which opens a Modal.
|
|
||||||
- Adds a plugin setting tab to the settings page.
|
|
||||||
- Registers a global click event and output 'click' to the console.
|
|
||||||
- Registers a global interval which logs 'setInterval' to the console.
|
|
||||||
|
|
||||||
## First time developing plugins?
|
- [✨ Key Features](#-key-features)
|
||||||
|
- [🎯 Why Typst Over Standard PDF Export?](#-why-typst-over-standard-pdf-export)
|
||||||
|
- [📥 Installation](#-installation)
|
||||||
|
- [🚀 Quick Start](#-quick-start)
|
||||||
|
- [⚙️ Configuration](#️-configuration)
|
||||||
|
- [📋 Requirements](#-requirements)
|
||||||
|
- [🎨 Available Templates](#-available-templates)
|
||||||
|
- [🔧 Advanced Usage](#-advanced-usage)
|
||||||
|
- [❗ Troubleshooting](#-troubleshooting)
|
||||||
|
- [🛠️ Development](#️-development)
|
||||||
|
- [🤝 Contributing](#-contributing)
|
||||||
|
- [📄 License](#-license)
|
||||||
|
|
||||||
Quick starting guide for new plugin devs:
|
## ✨ Key Features
|
||||||
|
|
||||||
- Check if [someone already developed a plugin for what you want](https://obsidian.md/plugins)! There might be an existing plugin similar enough that you can partner up with.
|
- **🎨 Multiple Templates**: Choose from built-in templates (default, modern, article, report) or create custom ones
|
||||||
- Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you don't see it).
|
- **📁 Batch Export**: Export entire folders of notes with a single click
|
||||||
- Clone your repo to a local development folder. For convenience, you can place this folder in your `.obsidian/plugins/your-plugin-name` folder.
|
- **🖼️ Media Support**: Smart handling of embedded images and PDFs
|
||||||
- Install NodeJS, then run `npm i` in the command line under your repo folder.
|
- **⚡ Real-time Progress**: Visual progress tracking with cancellation support
|
||||||
- Run `npm run dev` to compile your plugin from `main.ts` to `main.js`.
|
- **🔧 Advanced Configuration**: Comprehensive export options including typography, layout, and behavior settings
|
||||||
- Make changes to `main.ts` (or create new `.ts` files). Those changes should be automatically compiled into `main.js`.
|
- **🔍 Font Discovery**: Automatic system font detection and caching
|
||||||
- Reload Obsidian to load the new version of your plugin.
|
- **🛡️ Security First**: Path validation and sanitization for safe operations
|
||||||
- Enable plugin in settings window.
|
- **📐 Professional Layout**: Paper sizes, margins, typography controls, and more
|
||||||
- For updates to the Obsidian API run `npm update` in the command line under your repo folder.
|
|
||||||
|
|
||||||
## Releasing new releases
|
## 🎯 Why Typst Over Standard PDF Export?
|
||||||
|
|
||||||
- Update your `manifest.json` with your new version number, such as `1.0.1`, and the minimum Obsidian version required for your latest release.
|
Typst is a modern typesetting system that produces publication-quality documents with:
|
||||||
- Update your `versions.json` file with `"new-plugin-version": "minimum-obsidian-version"` so older versions of Obsidian can download an older version of your plugin that's compatible.
|
|
||||||
- Create new GitHub release using your new version number as the "Tag version". Use the exact version number, don't include a prefix `v`. See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases
|
|
||||||
- Upload the files `manifest.json`, `main.js`, `styles.css` as binary attachments. Note: The manifest.json file must be in two places, first the root path of your repository and also in the release.
|
|
||||||
- Publish the release.
|
|
||||||
|
|
||||||
> You can simplify the version bump process by running `npm version patch`, `npm version minor` or `npm version major` after updating `minAppVersion` manually in `manifest.json`.
|
- **Superior Typography**: Advanced font handling, ligatures, and mathematical typesetting
|
||||||
> The command will bump version in `manifest.json` and `package.json`, and add the entry for the new version to `versions.json`
|
- **Flexible Layouts**: Multi-column layouts, custom headers/footers, and precise spacing control
|
||||||
|
- **Fast Compilation**: Near-instant PDF generation compared to LaTeX
|
||||||
|
- **Modern Syntax**: Clean, readable markup that's easy to customize
|
||||||
|
- **Professional Output**: Conference-paper and book-quality formatting out of the box
|
||||||
|
|
||||||
## Adding your plugin to the community plugin list
|
## 📥 Installation
|
||||||
|
|
||||||
- Check the [plugin guidelines](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines).
|
### Method 1: Community Plugin Store (Recommended)
|
||||||
- Publish an initial version.
|
|
||||||
- Make sure you have a `README.md` file in the root of your repo.
|
|
||||||
- Make a pull request at https://github.com/obsidianmd/obsidian-releases to add your plugin.
|
|
||||||
|
|
||||||
## How to use
|
1. Open **Settings** → **Community Plugins**
|
||||||
|
2. **Disable Safe Mode** if needed
|
||||||
|
3. Click **Browse** and search for "Typst PDF Export"
|
||||||
|
4. **Install** and **Enable** the plugin
|
||||||
|
|
||||||
- Clone this repo.
|
### Method 2: Manual Installation
|
||||||
- Make sure your NodeJS is at least v16 (`node --version`).
|
|
||||||
- `npm i` or `yarn` to install dependencies.
|
|
||||||
- `npm run dev` to start compilation in watch mode.
|
|
||||||
|
|
||||||
## Manually installing the plugin
|
1. Download the latest release from [GitHub Releases](https://github.com/akucera/obsidian-typst-pdf-export/releases)
|
||||||
|
2. Extract the files to `{VaultFolder}/.obsidian/plugins/obsidian-typst-pdf-export/`
|
||||||
|
3. Reload Obsidian and enable the plugin in Settings
|
||||||
|
|
||||||
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`.
|
### Method 3: BRAT (Beta Reviewer's Auto-update Tool)
|
||||||
|
|
||||||
## Improve code quality with eslint (optional)
|
1. Install the [BRAT plugin](https://github.com/TfTHacker/obsidian42-brat)
|
||||||
- [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code.
|
2. Add this repository: `akucera/obsidian-typst-pdf-export`
|
||||||
- To use eslint with this project, make sure to install eslint from terminal:
|
3. Enable the plugin after installation
|
||||||
- `npm install -g eslint`
|
|
||||||
- To use eslint to analyze this project use this command:
|
|
||||||
- `eslint main.ts`
|
|
||||||
- eslint will then create a report with suggestions for code improvement by file and line number.
|
|
||||||
- If your source code is in a folder, such as `src`, you can use eslint with this command to analyze all files in that folder:
|
|
||||||
- `eslint .\src\`
|
|
||||||
|
|
||||||
## Funding URL
|
## 🚀 Quick Start
|
||||||
|
|
||||||
You can include funding URLs where people who use your plugin can financially support it.
|
### 1. Install Dependencies
|
||||||
|
|
||||||
The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file:
|
**Required:**
|
||||||
|
- [Pandoc](https://pandoc.org/installing.html) - Markdown to Typst conversion
|
||||||
|
- [Typst](https://typst.app/docs/reference/foundations/) - PDF generation
|
||||||
|
- [ImageMagick](https://imagemagick.org/script/download.php) - Enhanced image processing
|
||||||
|
|
||||||
```json
|
### 2. Export Your First Note
|
||||||
{
|
|
||||||
"fundingUrl": "https://buymeacoffee.com"
|
1. Open any note in Obsidian
|
||||||
}
|
2. Click the **Typst Export** ribbon icon or use `Ctrl/Cmd + P` → "Export to Typst PDF"
|
||||||
|
3. Configure your export settings in the modal
|
||||||
|
4. Click **Export** and select your output location
|
||||||
|
|
||||||
|
### 3. Verify Installation
|
||||||
|
|
||||||
|
Go to the plugin settings and click **Check Dependencies** to ensure all required tools are properly installed.
|
||||||
|
|
||||||
|
## ⚙️ Configuration
|
||||||
|
|
||||||
|
### Export Options
|
||||||
|
|
||||||
|
| Category | Options | Description |
|
||||||
|
|----------|---------|-------------|
|
||||||
|
| **General** | Template selection, paper size| Basic export configuration |
|
||||||
|
| **Typography** | Font family, size| Control document appearance |
|
||||||
|
| **Page Setup** | Margins, orientation | Layout customization |
|
||||||
|
|
||||||
|
### Templates
|
||||||
|
|
||||||
|
- **Default**: Clean, minimal design suitable for most documents
|
||||||
|
- **Modern**: Contemporary styling with accent colors and modern typography
|
||||||
|
- **Article**: Academic paper format with proper spacing and citations
|
||||||
|
- **Report**: Business/technical report format with structured sections
|
||||||
|
|
||||||
|
## 📋 Requirements
|
||||||
|
|
||||||
|
### System Requirements
|
||||||
|
|
||||||
|
- **Obsidian**: Version 1.9.12 or higher
|
||||||
|
- **Platform**: Desktop only (Windows, macOS, Linux) - I develop this on macOS, but it should in theory work on Windows and Linux. I just have no way to test it.
|
||||||
|
- **Node.js**: Version 16+ (for development)
|
||||||
|
|
||||||
|
### External Dependencies
|
||||||
|
|
||||||
|
| Tool | Purpose | Installation |
|
||||||
|
|------|---------|-------------|
|
||||||
|
| **Pandoc** | Markdown → Typst conversion | [Download here](https://pandoc.org/installing.html) |
|
||||||
|
| **Typst** | PDF generation | [Download here](https://typst.app/docs/reference/foundations/) |
|
||||||
|
| **ImageMagick** | Enhanced image processing (optional) | [Download here](https://imagemagick.org/script/download.php) |
|
||||||
|
|
||||||
|
### Dependency Verification
|
||||||
|
|
||||||
|
The plugin includes an automated dependency checker accessible through:
|
||||||
|
- Plugin settings → **Check Dependencies**
|
||||||
|
- Export modal → **Dependency Status** indicator
|
||||||
|
|
||||||
|
## 🎨 Available Templates
|
||||||
|
|
||||||
|
### Built-in Templates
|
||||||
|
|
||||||
|
1. **Default Template** (`default.typ`)
|
||||||
|
- Clean, minimal design
|
||||||
|
- Perfect for notes and documentation
|
||||||
|
- Supports all basic formatting
|
||||||
|
|
||||||
|
2. **Modern Template** (`modern.typ`)
|
||||||
|
- Contemporary styling with accent colors
|
||||||
|
- Enhanced typography and spacing
|
||||||
|
- Great for presentations and reports
|
||||||
|
|
||||||
|
3. **Article Template** (`article.typ`)
|
||||||
|
- Academic paper formatting
|
||||||
|
- Proper citation handling
|
||||||
|
- Structured section layouts
|
||||||
|
|
||||||
|
4. **Report Template** (`report.typ`)
|
||||||
|
- Business/technical document format
|
||||||
|
- Professional styling
|
||||||
|
- Multi-section organization
|
||||||
|
|
||||||
|
### Custom Templates
|
||||||
|
|
||||||
|
Create your own Typst templates by:
|
||||||
|
1. Adding `.typ` files to the plugin's `templates/` directory
|
||||||
|
2. Including template metadata at the top of your file
|
||||||
|
3. Following the Typst template structure
|
||||||
|
|
||||||
|
## 🔧 Advanced Usage
|
||||||
|
|
||||||
|
### Folder Export
|
||||||
|
|
||||||
|
Export multiple notes at once:
|
||||||
|
|
||||||
|
1. Right-click on any folder in the file explorer
|
||||||
|
2. Select **Export Folder to Typst PDF**
|
||||||
|
3. Configure batch export settings
|
||||||
|
4. Monitor progress in the export modal
|
||||||
|
|
||||||
|
### Embedded Media Handling
|
||||||
|
|
||||||
|
The plugin automatically processes:
|
||||||
|
- **Images**: PNG, JPG, GIF, WebP formats
|
||||||
|
- **PDFs**: Converted to images for Typst inclusion
|
||||||
|
- **Links**: Properly formatted in the output PDF
|
||||||
|
- **Math**: LaTeX math expressions rendered correctly
|
||||||
|
|
||||||
|
### Export Configuration Persistence
|
||||||
|
|
||||||
|
Your export settings are automatically saved and restored for consistent output across sessions.
|
||||||
|
|
||||||
|
## ❗ Troubleshooting
|
||||||
|
|
||||||
|
### Common Issues
|
||||||
|
|
||||||
|
| Problem | Solution |
|
||||||
|
|---------|----------|
|
||||||
|
| **"Pandoc not found"** | Install Pandoc and ensure it's in your system PATH |
|
||||||
|
| **"Typst not found"** | Install Typst CLI and verify PATH configuration |
|
||||||
|
| **Export hangs** | Check if files are locked by other applications |
|
||||||
|
| **Images not showing** | Verify image paths and file permissions |
|
||||||
|
| **Template errors** | Check template syntax and file integrity |
|
||||||
|
|
||||||
|
### Debug Steps
|
||||||
|
|
||||||
|
1. **Check Dependencies**: Use the built-in dependency checker
|
||||||
|
2. **Console Logs**: Open Developer Tools (Ctrl/Cmd+Shift+I) for error details
|
||||||
|
3. **Test Manually**: Try running Pandoc/Typst commands directly in terminal
|
||||||
|
4. **Clear Cache**: Reset plugin settings if needed
|
||||||
|
5. **Clean Install**: Remove and reinstall the plugin
|
||||||
|
|
||||||
|
### Getting Help
|
||||||
|
|
||||||
|
- **Issues**: Report bugs on [GitHub Issues](https://github.com/akucera/obsidian-typst-pdf-export/issues)
|
||||||
|
- **Discussions**: Join conversations in [GitHub Discussions](https://github.com/akucera/obsidian-typst-pdf-export/discussions)
|
||||||
|
- **Documentation**: Check the plugin's settings for inline help
|
||||||
|
|
||||||
|
## 🛠️ Development
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the repository
|
||||||
|
git clone https://github.com/akucera/obsidian-typst-pdf-export.git
|
||||||
|
cd obsidian-typst-pdf-export
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Start development server
|
||||||
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
If you have multiple URLs, you can also do:
|
### Project Structure
|
||||||
|
|
||||||
```json
|
```
|
||||||
{
|
obsidian-typst-pdf-export/
|
||||||
"fundingUrl": {
|
├── src/
|
||||||
"Buy Me a Coffee": "https://buymeacoffee.com",
|
│ ├── core/ # Core system components
|
||||||
"GitHub Sponsor": "https://github.com/sponsors",
|
│ ├── converters/ # Conversion pipeline
|
||||||
"Patreon": "https://www.patreon.com/"
|
│ ├── ui/ # User interface components
|
||||||
}
|
│ ├── templates/ # Template management
|
||||||
}
|
│ └── utils/ # Utility functions
|
||||||
|
├── templates/ # Built-in Typst templates
|
||||||
|
├── main.ts # Plugin entry point
|
||||||
|
└── manifest.json # Plugin metadata
|
||||||
```
|
```
|
||||||
|
|
||||||
## API Documentation
|
### Build Commands
|
||||||
|
|
||||||
See https://github.com/obsidianmd/obsidian-api
|
```bash
|
||||||
|
npm run dev # Development with file watching
|
||||||
|
npm run build # Production build with type checking
|
||||||
|
npm run version # Version bump and manifest update
|
||||||
|
```
|
||||||
|
|
||||||
|
### Architecture
|
||||||
|
|
||||||
|
The plugin follows a modular architecture with:
|
||||||
|
- **Conversion Pipeline**: Markdown → Typst → PDF via Pandoc
|
||||||
|
- **Template System**: Dynamic template loading and management
|
||||||
|
- **Security Layer**: Path validation and sanitization
|
||||||
|
- **Progress Tracking**: Real-time feedback with cancellation support
|
||||||
|
|
||||||
|
## 🤝 Contributing
|
||||||
|
|
||||||
|
We welcome contributions! Please read our [Contributing Guidelines](CONTRIBUTING.md) before submitting pull requests.
|
||||||
|
|
||||||
|
### Development Guidelines
|
||||||
|
|
||||||
|
1. **Fork** the repository
|
||||||
|
2. **Create** a feature branch: `git checkout -b feature/amazing-feature`
|
||||||
|
3. **Follow** TypeScript and ESLint conventions
|
||||||
|
4. **Test** your changes thoroughly in Obsidian
|
||||||
|
5. **Commit** with descriptive messages: `git commit -m 'feat: add amazing feature'`
|
||||||
|
6. **Push** to your branch: `git push origin feature/amazing-feature`
|
||||||
|
7. **Submit** a Pull Request
|
||||||
|
|
||||||
|
### Code Style
|
||||||
|
|
||||||
|
- Follow existing TypeScript patterns and conventions
|
||||||
|
- Use meaningful variable and function names
|
||||||
|
- Add comments for complex logic
|
||||||
|
- Ensure proper error handling
|
||||||
|
- Write modular, testable code
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||||
|
|
||||||
|
### Third-Party Licenses
|
||||||
|
|
||||||
|
This plugin uses the following dependencies:
|
||||||
|
- **gray-matter** (MIT License) - YAML front matter parsing
|
||||||
|
- **pdf-to-img** (MIT License) - PDF to image conversion
|
||||||
|
- **sharp** (Apache 2.0 License) - High-performance image processing
|
||||||
|
|
||||||
|
## ☕ Support the Project
|
||||||
|
|
||||||
|
If you find this plugin helpful, consider supporting its development:
|
||||||
|
|
||||||
|
[](https://buymeacoffee.com/babylondreams)
|
||||||
|
[](https://ko-fi.com/babylondreams)
|
||||||
|
[](https://patreon.com/babylondreams)
|
||||||
|
|
||||||
|
## 📞 Contact & Support
|
||||||
|
|
||||||
|
**Author**: Alexander Kucera
|
||||||
|
**Website**: [alexanderkucera.com](https://alexanderkucera.com)
|
||||||
|
**GitHub**: [@akucera](https://github.com/akucera)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**⭐ If this plugin helped you, please consider giving it a star on GitHub!**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Last Updated: September 2025*
|
||||||
@@ -6,5 +6,10 @@
|
|||||||
"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",
|
||||||
"authorUrl": "https://alexanderkucera.com",
|
"authorUrl": "https://alexanderkucera.com",
|
||||||
|
"fundingUrl": {
|
||||||
|
"Buy Me a Coffee": "https://buymeacoffee.com/babylondreams",
|
||||||
|
"Ko-fi": "https://ko-fi.com/babylondreams",
|
||||||
|
"Patreon": "https://patreon.com/babylondreams"
|
||||||
|
},
|
||||||
"isDesktopOnly": true
|
"isDesktopOnly": true
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user