README file from
GithubCodeScript Toolkit
formerly known as
Fix Require Modules, see Rebranding section for more details
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.
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 works as plain markdown on GitHub, no installation needed.
A copy of the vault ships with every release. You can access it via any of the following:
- Running the CodeScript Toolkit: Open demo vault command.
- Downloading
fix-require-modules-demo-vault-<version>.zip(<version>is the release version) from the Releases. - 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()— orawait 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:
Installation
The plugin is available in the official Community Plugins repository.
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:
- Ensure you have the BRAT plugin installed and enabled.
- Click Install via BRAT.
- An Obsidian pop-up window should appear. In the window, click the
Add pluginbutton once and wait a few seconds for the plugin to install.
Debugging
By default, debug messages for this plugin are hidden.
To show them, run the following command:
window.DEBUG.enable('fix-require-modules');
For more details, refer to the Obsidian Dev Utils debugging guide.
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
My other Obsidian resources
See my other Obsidian resources.