Skip to content

refmdio/sample-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample Plugin

This repository hosts the reference sample plugin for RefMD. It demonstrates:

  • A minimal Extism backend + ESM frontend
  • Commands (sample.*) that return host-applied effects
  • Keeping plugin metadata (author, repository) in the manifest
  • Provisioning sandbox documents via the sample.create command

Build & Release (npm-only)

GitHub Actions (.github/workflows/build-plugin.yml) builds the plugin and:

  1. Checks out the repository
  2. Installs Rust stable with the wasm32-wasip1 target
  3. Installs Node.js 20 and runs npm ci && npm run build to bundle the frontend
    • The frontend (frontend/index.mjs) imports @refmdio/plugin-sdk
    • The build bundles the SDK into a single ESM at frontend/dist/index.mjs
  4. Runs cargo build --release --target wasm32-wasip1
  5. Packages backend/plugin.wasm, frontend/dist/index.mjs (as dist/index.mjs), and plugin.json into a zip named ${PLUGIN_ID}-plugin.zip
  6. Uploads that zip as both an Actions artifact and a GitHub Release asset (when the ref is a tag like v*)

Installation

To install in RefMD:

  1. Open the Plugins page (/plugins)
  2. Use “Install from URL” and paste https://github.com/refmdio/sample-plugin/releases/download/<tag>/sample-plugin.zip

After installation, the toolbar exposes New Sample Document (sample.create). When invoked, it provisions a demo document marked with meta.isSample = true. Opening that document routes to /sample/<docId> where the frontend handles records and markdown rendering.

See docs/overview.md and docs/architecture.md for a detailed walkthrough.

About

Sample Plugin for RefMD

Resources

Stars

Watchers

Forks

Packages

No packages published