Skip to content
cook-mdPublic

About

First-party plugins for Cook Editor, and a reference for writing your own.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cook Editor Plugins

First-party plugins for Cook Editor, and a reference for writing your own. Each plugin is a standalone npm package in its own folder.

Plugin Description
meal-journal Daily meal journal in Cooklang markup. Start here — it demonstrates the most common plugin APIs.
shopping-list Aisle-grouped shopping lists with pantry subtraction. Ships with Cook Editor. Shows the Cooklang API and outlets.
favourites Heart on recipe previews and a Favourites view, stored in a plain-text .bookmarks file. Ships with Cook Editor. Shows context keys driving toolbar when clauses, a tree view and cooklang.api.openPreview.
pantry See and edit config/pantry.conf: stock levels, low and out-of-stock items, expiry. Install it from the Extensions view. Shows editing a config file through the Cooklang API.
pantry-match "What can I cook?": ranks your recipes by what's in config/pantry.conf (Cook now, Missing 1–2, Use it up) and adds a Have 9/11 badge to recipe previews. Free, works signed out. Install it from the Extensions view. Shows an Explorer tree view over the whole workspace, a names-only template rendered with cooklang.api.renderReport, and calling another plugin's command (shoppingList.addRecipe).
recipe-hub Search recipes.cooklang.org, preview results and save them to Drafts. Install it from the Extensions view. Shows a read-only file system provider and cooklang.api.saveDraft.
nutriscore Nutri-Score badge on recipe previews, with a hover card showing how reliable it is. Needs a Cook Basic or Pro plan. Install it from the Extensions view. Shows the preview badge outlet and rendering a report template with cooklang.api.renderReport.
allergens Flags the allergens you choose on recipe previews: the 14 regulated allergens (Cook Basic or Pro) and your own words (free). Install it from the Extensions view. Shows a pill preview badge and cooklang.api.refreshBadges.
corevitals Vitals 14/17 badge on meal plans and recipes: targets met against FDA/EU/UK daily values, with a full report with charts. Needs a Cook Basic or Pro plan. Install it from the Extensions view. Shows the menu badge outlet and opening a report tab with cooklang.api.openReport.
diet-badges Vegan, Vegetarian, Pescatarian or Dairy-free badge on recipe and meal-plan previews: green when every ingredient was checked, amber with ? when something couldn't be. Needs a Cook Basic or Pro plan. Install it from the Extensions view. Shows one command serving both badge outlets and is_in_category in a report template.
macros 38P 52C 14F · 520 kcal pill on recipe previews (per serving) and meal plans (per person per day), with a hover table of macros and energy shares. Needs a Cook Basic or Pro plan. Install it from the Extensions view. Shows one badge command on both badge outlets and a template that branches on the engine's plan context.
cookbook Turns a folder of recipes into a printable PDF cookbook: cover, contents, a chapter per subfolder, photos and an ingredient index. Free; a nutrition line with a Cook Basic or Pro plan. Install it from the Extensions view. Shows an Explorer folder menu, cooklang.api.recipeImages and cooklang.api.exportPdf.

How plugins work

Cook Editor is built on Eclipse Theia, which runs VS Code-style extensions: plugins are written against the VS Code Extension API and declare their UI contributions (commands, menus, keybindings, settings, snippets, languages) in package.json. Cook Editor currently supports VS Code API 1.110.

At startup the app loads every plugin found in editor/plugins/ — an unpacked .vsix layout or a plain folder with a package.json both work. The meal-journal plugin demonstrates:

  • Commands + keybindings + menus — contributes.commands, keybindings, menus (with when clauses scoping buttons to .journal files)
  • Settings — contributes.configuration, read via workspace.getConfiguration(...)
  • Language association — contributes.languages adding .journal to the built-in cooklang language, inheriting its grammar and language server
  • Snippets — contributes.snippets
  • Status bar — window.createStatusBarItem(...) in activate()
  • Workspace file access — workspace.fs (URI-based), workspace.findFiles
  • Quick-pick UI — window.showQuickPick

Writing a new plugin

For a step-by-step walkthrough, from an empty folder to a plugin published on plugins.cook.md, see the plugin tutorial.

  1. Copy the meal-journal folder structure: package.json (manifest), tsconfig.json, src/extension.ts with an exported activate().
  2. The manifest needs name, version, publisher, engines.vscode, and main pointing at the compiled entry point.
  3. Keep logic that doesn't need the vscode API in separate modules — they can be unit-tested with plain mocha (see src/journal-files.spec.ts).
  4. Build and deploy: npm run deploy copies the plugin into ../../editor/plugins/<publisher>.<name>.
  5. Start the editor: cd ../../editor && npm run start:electron. The app copies editor/plugins into its own plugins folder on every start.

The dev loop is: edit → npm run deploy → restart the editor.

Publishing to plugins.cook.md

Releases go to the Cook plugins marketplace (an OpenVSX-compatible registry). One-time setup:

  1. Sign in at https://plugins.cook.md with GitHub and create a personal access token (PAT) in your dashboard.

  2. Create the namespace matching the plugin's publisher (once per namespace):

    npx ovsx create-namespace cooklang -r https://plugins.cook.md -p <PAT>

To release a new version:

cd meal-journal
npm version patch        # or minor/major — updates package.json
npm run package          # builds meal-journal-<version>.vsix
OVSX_PAT=<PAT> npm run publish:marketplace

Verify with curl https://plugins.cook.md/api/cooklang/meal-journal.

Useful references

About

First-party plugins for Cook Editor, and a reference for writing your own.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages