返回顶部
o

obsidian-plugin

Create and develop Obsidian plugins from scratch. Use when building a new Obsidian plugin, scaffolding from the sample-plugin-plus template, or developing plugin features. Covers project setup, manifest configuration, TypeScript development, settings UI, commands, ribbons, modals, and Obsidian API patterns.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,672
下载量
2
收藏
概述
安装方式
版本历史

obsidian-plugin

# Obsidian Plugin Development Build production-ready Obsidian plugins using the [obsidian-sample-plugin-plus](https://github.com/davidvkimball/obsidian-sample-plugin-plus) template. ## Quick Start: New Plugin ### 1. Create from Template ```bash # Clone the template (or use GitHub's "Use this template" button) gh repo create my-plugin --template davidvkimball/obsidian-sample-plugin-plus --public --clone cd my-plugin # Or clone directly git clone https://github.com/davidvkimball/obsidian-sample-plugin-plus.git my-plugin cd my-plugin rm -rf .git && git init ``` ### 2. Configure Plugin Identity Update these files with your plugin's info: **manifest.json:** ```json { "id": "my-plugin", "name": "My Plugin", "version": "0.0.1", "minAppVersion": "1.5.0", "description": "What your plugin does", "author": "Your Name", "authorUrl": "https://yoursite.com", "isDesktopOnly": false } ``` **package.json:** Update `name`, `description`, `author`, `license`. **README.md:** Replace template content with your plugin's documentation. ### 3. Initialize Development Environment ```bash pnpm install pnpm obsidian-dev-skills # Initialize AI skills ./scripts/setup-ref-links.sh # Unix # or: scripts\setup-ref-links.bat # Windows ``` ### 4. Clean Boilerplate In `src/main.ts`: - Remove sample ribbon icon, status bar, commands, modal, and DOM event - Keep the settings tab if needed, or remove it - Rename `MyPlugin` class to your plugin name Delete `styles.css` if your plugin doesn't need custom styles. ## Development Workflow ### Build & Test ```bash pnpm dev # Watch mode — rebuilds on changes pnpm build # Production build pnpm lint # Check for issues pnpm lint:fix # Auto-fix issues pnpm test # Run unit tests ``` ### Install in Obsidian Copy build output to your vault: ```bash # Unix cp main.js manifest.json styles.css ~/.obsidian/plugins/my-plugin/ # Or create a symlink for development ln -s $(pwd) ~/.obsidian/plugins/my-plugin ``` Enable the plugin in Obsidian Settings → Community Plugins. Use [Hot Reload](https://github.com/pjeby/hot-reload) plugin for automatic reloading during development. ## Plugin Architecture ### Entry Point (`src/main.ts`) ```typescript import { Plugin } from 'obsidian'; export default class MyPlugin extends Plugin { settings: MyPluginSettings; async onload() { await this.loadSettings(); // Register commands, ribbons, events, views } onunload() { // Cleanup: remove event listeners, views, DOM elements } async loadSettings() { this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); } async saveSettings() { await this.saveData(this.settings); } } ``` ### Settings Pattern See [references/settings.md](references/settings.md) for the complete settings UI pattern. ### Common Patterns See [references/patterns.md](references/patterns.md) for: - Commands (simple, editor, check callbacks) - Ribbon icons - Modals - Events and lifecycle - File operations - Editor manipulation ## Constraints - **No auto-git**: Never run `git commit` or `git push` without explicit approval - **No eslint-disable**: Fix lint issues properly, don't suppress them - **No `any` types**: Use proper TypeScript types - **Sentence case**: UI text uses sentence case (ESLint may false-positive on this — ignore if so) ## Release Checklist 1. Update version in `manifest.json` and `package.json` 2. Update `versions.json` with `"version": "minAppVersion"` 3. Run `pnpm build` — zero errors 4. Run `pnpm lint` — zero issues 5. Create GitHub release with tag matching version (no `v` prefix) 6. Upload: `main.js`, `manifest.json`, `styles.css` (if used) ## References - [Settings UI](references/settings.md) — Complete settings tab implementation - [Common Patterns](references/patterns.md) — Commands, modals, events, file operations - [Obsidian API Docs](https://docs.obsidian.md) — Official documentation

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 obsidian-plugin-dev-1776014236 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 obsidian-plugin-dev-1776014236 技能

通过命令行安装

skillhub install obsidian-plugin-dev-1776014236

下载 Zip 包

⬇ 下载 obsidian-plugin v1.0.0

文件大小: 6.88 KB | 发布时间: 2026-4-13 11:14

v1.0.0 最新 2026-4-13 11:14
obsidian-plugin 1.0.0

- Initial release.
- Provides step-by-step instructions for setting up, developing, building, and releasing Obsidian plugins using the obsidian-sample-plugin-plus template.
- Includes guidance on manifest configuration, TypeScript development, settings UI, commands, ribbons, modals, and Obsidian API patterns.
- Documents development workflow, common patterns, plugin architecture, constraints, and release checklist.
- Adds quick references to relevant documentation and code patterns.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部