Quick Start¶
Quickly get started creating your own INK plugins by following these easy steps.
Install the INK CLI tool
inkplugin
globally usingnpm install -g inkplugin
Create an INK Plug-in project using
inkplugin create <your-project-name>
Start writing your plug-in code in this
main.js
using our INK APIs.
Note
Under the engines
section in package.json
, the CLI tool will automatically add the latest version of the INK Editor Support. Feel free to change this according to your need.
In its simplest form, the plug-in main entry JS file looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 | importScripts('./inkapi.js');
INKAPI.ready(() => {
const UI= INKAPI.ui;
const IO= INKAPI.io;
const Editor= INKAPI.editor;
//your code here
console.log("Hello, INK Plugin World!");
});
|
Note
Because each INK plug-in runs inside a separate worker, we use importScript to import INK APIs.
In the above example, you’ll notice that we import inkapi.js
in order to provide the INK API globally. Once the INK API is ready to use, you can take advantage of its ready function to initiate the plug-in code. Additionally, you’ll also notice some API namespaces that are available through the INK API.
How to Package Your Plug-in¶
To package your plug-in, use the INK CLI inkplugin package
command in our project root directory:
inkplugin package
This command will create a packaged plugin file which is also know as Dye
file. This file will be used for installing your plugin into INK editor.
How to Install Your Plug-in¶
It’s super easy to install a plug-in Dye
file in the INK Editor. Just drag and drop your Dye file into the INK Editor. Then, INK will prompt you to confirm. When this happens, click on “Install Now” and you’re done!
Alternatively, you can manually install your plug-in by opening the Plug-in Sidebar on the left side of the editor. Then, click on the “Add Plugin” option. This will open up a dialog box where you can select your Dye file.
After completing the plug-in installation, check that your plug-in created the as Demo HTML
entry in the export menu and try to export some content.
Note
More in INK API Namescapes under the APIs section.
More on the INK CLI Tool under the Command Line Tools section.