スキル一覧に戻る
yankeeinlondon

obsidian

by yankeeinlondon

An obsidian plugin for getting things done

1🍴 0📅 2025年12月22日
GitHubで見るManusで実行

SKILL.md


name: obsidian description: Expert knowledge for developing Obsidian plugins and themes using TypeScript, CodeMirror 6, and CSS variables - covers plugin lifecycle, Vault API, Workspace API, editor extensions, and styling patterns hash: 881a7930a553c0d8

Obsidian Plugin & Theme Development

Build plugins and themes for Obsidian using TypeScript, CodeMirror 6, and CSS variables.

Core Principles

  • Extend Plugin class - Use onload() for setup, onunload() for cleanup
  • Access app via this.app - Never use global window.app (debugging only)
  • Prefer Vault API - Use this.app.vault over raw Adapter for file ops
  • Wait for layout ready - Use app.workspace.onLayoutReady() for startup logic
  • Register events properly - Use this.registerEvent() for auto-cleanup
  • Mark external CM6 deps - Never bundle @codemirror/*, use Obsidian's copy
  • Use CSS variables - Override theme variables, not hardcoded colors
  • Avoid !important - Let users override with snippets
  • Mobile compatibility - Check Platform.isMobile before Node.js APIs
  • Security first - Never use innerHTML with user input

Quick Reference

// Basic plugin structure
import { Plugin, Notice } from 'obsidian';

export default class MyPlugin extends Plugin {
  async onload() {
    // Add command
    this.addCommand({
      id: 'my-command',
      name: 'My Command',
      callback: () => new Notice('Hello!')
    });

    // Add ribbon icon
    this.addRibbonIcon('dice', 'My Plugin', () => {});

    // Register events (auto-cleanup on unload)
    this.registerEvent(
      this.app.vault.on('modify', (file) => {})
    );

    // Register CM6 extension
    this.registerEditorExtension(myExtension);
  }
}

Topics

Plugin Development

Editor Integration

Styling

  • Themes & CSS - CSS variables, theme structure, styling patterns

Advanced APIs

Common Patterns

Wait for Vault Ready

async onload() {
  this.app.workspace.onLayoutReady(() => {
    // Safe to access vault files here
    const files = this.app.vault.getMarkdownFiles();
  });
}

Process Frontmatter Safely

await this.app.fileManager.processFrontMatter(file, (fm) => {
  fm.status = 'done';
});

Register Editor Extension

import { ViewPlugin, DecorationSet } from '@codemirror/view';

const myPlugin = ViewPlugin.fromClass(class {
  decorations: DecorationSet;
  // ... implementation
}, { decorations: v => v.decorations });

this.registerEditorExtension(myPlugin);

Resources

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です