CodeScript Toolkit

approved

by Michael Naumov

Allows to do a lot of things with JavaScript/TypeScript scripts from inside the Obsidian itself

★ 148 stars↓ 24,094 downloadsUpdated 5d agoMIT

CodeScript Toolkit

formerly known as Fix Require Modules, see Rebranding section for more details

Buy Me a Coffee GitHub release Obsidian downloads Minimum Obsidian version Coverage: 100%

An Obsidian plugin that lets you write and run modern JavaScript and TypeScript inside Obsidian — in a note, as a command, on a hotkey, at startup — with a rich module system, bringing you the best practices from the modern development ecosystem.

Runnable JavaScript and TypeScript, right in the note

More screenshots
Click it and the result appears underneath Written as a fenced block, versioned with the note Every script in your folder becomes a command, hotkey and all A note can import a TypeScript module living in your vault Runnable JavaScript and TypeScript, on your phone Tap it and the result appears underneath Written as a fenced block, versioned with the note Every script in your folder becomes a command A note can import a TypeScript module living in your vault

Demo vault

The documentation is an interactive demo vault. Every feature has a note that explains what it does and why you would want it, followed by a button that runs it for real — so you can read the explanation and execute the example in the same place.

Start reading here — it is plain markdown, so it works on GitHub with nothing installed.

A copy of the vault ships with every release. You can access it via any of the following:

  1. Running the CodeScript Toolkit: Open demo vault command.
  2. Downloading fix-require-modules-demo-vault.zip from the Releases. It unzips into a single fix-require-modules-demo-vault-<version> folder.
  3. Browsing its source in demo-vault/ in this repository.

If you are not sure where to start, three notes cover most of it: Core functions (which of require() / requireAsync() / requireAsyncWrapper() to use), Code buttons (runnable snippets inside a note), and Invocable scripts (turning a script into an Obsidian command).

What it does

  • Loads CJS/ES modules, TypeScript, JSON, npm packages, Node built-ins, WebAssembly, ASAR archives and URLs with require() — or await requireAsync(), which also works on mobile.
  • Runs your scripts from a note, an Obsidian command, a hotkey, a startup script, or an obsidian:// URL.
  • Lets you prototype a plugin, and explore the Obsidian API — public and internal — at runtime.
  • Enriches scripting capabilities of DevTools console.
  • Enriches the scripting plugins you already use:

Use cases

  • A button in a note that does a job. Put a ```code-button block in your daily note template that moves finished tasks, renames attachments or fills in a property, and click it when you need it. See Code buttons.

  • A script you run from the command palette or a hotkey. Every script in your scripts folder becomes a command, so a one-off chore becomes a hotkey without writing a plugin. See Invocable scripts and Hotkeys.

  • A scratch script for the job you will do once. One note holds a throwaway script you rewrite for whatever comes up, and the Run scratch script command runs it without opening the note. See Scratch script.

  • One helper module shared by every scripting plugin. Write a function once, in TypeScript if you like, and require() it from Dataview, Templater, QuickAdd or CustomJS, instead of pasting a copy into each. See Working with other plugins.

  • Using an npm package in the vault, such as a date library or a parser. See NPM modules.

  • Trying out the Obsidian API, or a plugin idea, before building anything. The DevTools console gets the same require() as a button. If your scripts folder holds helpers.ts, open the console (Ctrl/Command + Shift + I) and run:

    require('/helpers.ts').summarize(app.workspace.getActiveFile());
    

    The leading / means the scripts folder. See DevTools Console.

See also

My other Obsidian resources

PluginFeaturesHow CodeScript Toolkit differs
CustomJSVault JavaScript classes; global object; startup and hotkey scriptsBroader module shapes: TypeScript and ordinary modules; no one-class-per-file requirement
Execute CodeCode blocks in 20+ languages; external interpretersNarrower language scope: JavaScript/TypeScript inside Obsidian, with its API
JavaScript InitOne settings-stored JavaScript snippet at startupBroader entry points: vault-file startup script, buttons, commands, hotkeys and URLs
JS Enginejs-engine blocks; Markdown results; view-building APIOverlaps on in-note code; module system and script entry points beyond blocks
ModulesVault/Internet JavaScript and TypeScript modules; Markdown modules; source mapsOverlaps on module loading; also code buttons, commands, hotkeys and startup scripts
Plugin REPLEvaluates editor lines/selections; inserts results; editor helpersAlternative execution scope: whole scripts and modules
RunJSNamed JavaScript snippets; code list, picker, commands, ribbon and startupOverlaps on script entry points; also TypeScript compilation and npm packages
Safe JSIsolated Web Workers; permission-gated API; no DOM, Node.js or app accessAlternative trust model: full Obsidian access; no sandbox
User PluginsVault JavaScript as small plugins; onload instance; commandsAlternative script shape: ordinary modules; notes and commands as entry points

Last searched for similar plugins on 2026-10-26.

Installation

The plugin is available in the official Community Plugins repository.

Requirements

On mobile, the plugin runs on the device's own web engine, and it needs a modern one:

  • iOS / iPadOS 16.4 or later. Older versions cannot even load the plugin: it fails to enable with Plugin failure: fix-require-modules. Devices that cannot update past iOS 15, such as the iPad mini 4, are not supported.
  • Android: an up-to-date Android System WebView (version 97 or later). If the plugin fails to enable on Android, update that app first.

Beta versions

To install the latest beta release of this plugin (regardless if it is available in the official Community Plugins repository or not), follow these steps:

  1. Ensure you have the BRAT plugin installed and enabled.
  2. Click Install via BRAT.
  3. An Obsidian pop-up window should appear. In the window, click the Add plugin button once and wait a few seconds for the plugin to install.

Debugging

By default, debug messages for this plugin are hidden. Its debug namespace is its plugin id, fix-require-modules, not codescript-toolkit: the id kept the plugin's old name (see Rebranding). To show the messages, run this in the DevTools console:

window.DEBUG.enable('fix-require-modules');

The debugging guide explains how to narrow or widen that namespace.

Rebranding

This plugin was formerly known as Fix Require Modules.

The plugin quickly overgrew its original purpose and got way more features than just fixing require() calls. That's why it got a new name.

However, for the backward compatibility, the previous id fix-require-modules is still used internally and you might find it

  • in plugin folder name;
  • in plugin URL;
  • in Debugging section;

Changelog

All notable changes to this project will be documented in the CHANGELOG.

Contributing

Contributions are welcome — see CONTRIBUTING to get set up.

Support

Buy Me A Coffee

Filing an issue (for AI agents and humans)

Open issues through the issue forms, not as blank issues.

To report a bug from inside Obsidian, run the CodeScript Toolkit: Report a bug command. It opens the bug form with the plugin version, the Obsidian version and your operating system already filled in.

Filing from the CLI or the API (gh issue create --body, or an AI agent filing for you) skips the form, and gh issue create --template cannot load an issue form. In that case, open the matching form in .github/ISSUE_TEMPLATE/, copy every field as a ### <label> heading in the form's order, and fill in each one. Always state the plugin version, the Obsidian version and your operating system.

License

© Michael Naumov

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.