npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

inkdown-api

v0.1.1

Published

TypeScript definitions for Inkdown plugin development

Readme

@inkdown/plugin-api

TypeScript definitions for Inkdown plugin development.

Installation

npm install @inkdown/plugin-api --save-dev
# or
bun add @inkdown/plugin-api --dev

Usage

Create a plugin by extending the Plugin class:

import { Plugin, Notice, Setting, PluginSettingTab } from '@inkdown/plugin-api';

interface MyPluginSettings {
  mySetting: string;
}

const DEFAULT_SETTINGS: MyPluginSettings = {
  mySetting: 'default'
};

export default class MyPlugin extends Plugin {
  settings: MyPluginSettings;

  async onload() {
    // Load settings
    await this.loadSettings();

    // Add a command
    this.addCommand({
      id: 'my-command',
      name: 'My Command',
      callback: () => {
        new Notice('Hello from my plugin!');
      }
    });

    // Add a settings tab
    this.addSettingTab(new MyPluginSettingTab(this.app, this));
  }

  async loadSettings() {
    this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
  }

  async saveSettings() {
    await this.saveData(this.settings);
  }

  async onunload() {
    // Cleanup (optional)
  }
}

class MyPluginSettingTab extends PluginSettingTab {
  plugin: MyPlugin;

  constructor(app: App, plugin: MyPlugin) {
    super(app, plugin);
    this.plugin = plugin;
  }

  display(): void {
    const { containerEl } = this;
    containerEl.empty();

    new Setting(containerEl)
      .setName('My Setting')
      .setDesc('Description of my setting')
      .addText(text => text
        .setValue(this.plugin.settings.mySetting)
        .onChange(async (value) => {
          this.plugin.settings.mySetting = value;
          await this.plugin.saveSettings();
        }));
  }
}

API Reference

Core Classes

  • Plugin - Base class for all plugins
  • Component - Base class for lifecycle management
  • ItemView - Base class for custom views

UI Components

  • Modal - Base class for modal dialogs
  • ConfirmModal - Yes/no confirmation modal
  • FuzzySuggestModal - Modal with fuzzy search
  • Notice - Toast notifications
  • Setting - Settings UI builder
  • PluginSettingTab - Plugin settings tab

Editor

  • EditorSuggest - In-editor autocomplete
  • IEditor - Editor interface

Events

  • Events - Event emitter base class
  • EventRef - Event reference for cleanup

Markdown Processing

  • MarkdownCodeBlockProcessor - Process code blocks
  • MarkdownPostProcessor - Post-process rendered markdown

Plugin Structure

Your plugin should have the following files:

my-plugin/
├── manifest.json    # Plugin metadata
├── main.js          # Compiled plugin code
├── styles.css       # Optional styles
└── README.md        # Documentation

manifest.json

{
  "id": "my-plugin",
  "name": "My Plugin",
  "version": "1.0.0",
  "minAppVersion": "0.1.0",
  "description": "A description of my plugin",
  "author": "Your Name",
  "authorUrl": "https://github.com/yourusername"
}

Building Your Plugin

We recommend using esbuild for building:

// esbuild.config.mjs
import esbuild from 'esbuild';

esbuild.build({
  entryPoints: ['main.ts'],
  bundle: true,
  external: ['@inkdown/plugin-api'],
  format: 'cjs',
  target: 'es2020',
  outfile: 'main.js',
});

License

MIT