actualNoteContentPart: ## Code
  The first code block in the note will be used as the plugin's code. Any subsequent code blocks will be ignored. The plugin code should define a Javascript object. Any functions defined on this object that match the name of an [action](/help/developing_amplenote_plugins/actions)  will register the plugin to handle that action.
  ```
  {  insertText(app) {    return "Hello World!"  }} 
  ```
  
  To define multiple actions for a single action type, make the action-named field an object. The keys should be the name of the action, with the corresponding function as the value.
  ```
  {  insertText: {    "one word": function(app) {      return "hello";    },    "two words": function(app) {      return "hello world";    }  }}
  ```
  
  Plugin actions can either be a function - as shown above - or an object with run and check keys with functions as the values (see [actions](/help/developing_amplenote_plugins/actions)  section for further explanation):
  ```
  {  insertText: {    check(app) {      return true;    },    run(app) {      return "Hello World!";      }  }} 
  ```
  and:
  ```
  {  insertText: {    "one word": {      check(app) {        return true;      },      run(app) {        return "hello";      }    },    "two words": function() {      check(app) {        return true;      },      run(app) {        return "hello world";      }    }  }}
  ```
  
  When plugin code is invoked, the plugin object will be this, for example:
  ```
  {  insertText(app) {    return this._text();  },   _text() {    return "hello world";  }} 
  ```
  
  The plugin object will be instantiated when the plugin is installed in the client, retaining any state until it is reloaded (e.g. due to the plugin code being changed in the source note).
  ```
  {  insertText(app) {    this._counter++;    return "hello " + this._counter;  },   _counter: 0,}
  ```
  
  Plugin action functions (both run and check) can return promises, which will be awaited. 
  ```
  {  insertText: {    check(app) {      return new Promise(function(resolve) {        setTimeout(resolve, 2000);      }).then(function() {        return true;      });      },    run(app) {      return new Promise(function(resolve) {        setTimeout(resolve, 2000);      }).then(function() {        return "hello world, eventually";      });        }  }}
  ```
  Or, they can use async/await syntax:
  ```
  {  insertText: {    async check(app) {      await new Promise(function(resolve) { setTimeout(resolve, 2000); });      return true;    },    async run(app) {      await new Promise(function(resolve) { setTimeout(resolve, 2000); });      return "hello world, eventually";    }  }}
  ```
  
  The first argument passed to a plugin action function is an application interface object that can be used to access settings and call into the host application itself.
  
  ### Accessing settings
  Given a plugin with the following metadata table entry:
  
  | setting | API Key | 
  A plugin can access the setting through app.settings:
  ```
  {  insertText(app) {    return app.settings["API Key"];  }}
  ```
  
  ### Action function arguments
  For action functions that receive arguments, the app argument will still be the first argument, before any other arguments:
  ```
  {  replaceText(app, text) {    return text + " more";  }}
  ```
  
  When using check and run functions, they will receive the same arguments as the action would. So for the linkOption action, for example:
  ```
  {  linkOption: {    check(app, link) {      return true;    },     run(app, link) {      console.log("Hello!");    }  }} 
  ```
processedNoteContent: ---
  title: Plugin Creation: Define settings, name and meta...
  headers: ## Code
  ---
  Code
  The first code block in the note will be used as the plugin's code. Any subsequent code blocks will be ignored. The plugin code should define a Javascript object. Any functions defined on this object that match the name of an [action](/help/developing_amplenote_plugins/actions)
    will register the plugin to handle that action. {  insertText(app) {    return "Hello World!"  }} 
  To define multiple actions for a single action type, make the action-named field an object. The keys should be the name of the action, with the corresponding function as the value. {  insertText: {    "one word": function(app) {      return "hello";    },    "two words": function(app) {      return "hello world";    }  }}
  Plugin actions can either be a function - as shown above - or an object with run and check keys with functions as the values (see [actions](/help/developing_amplenote_plugins/actions)
    section for further explanation): {  insertText: {    check(app) {      return true;    },    run(app) {      return "Hello World!";      }  }} 
  and: {  insertText: {    "one word": {      check(app) {        return true;      },      run(app) {        return "hello";      }    },    "two words": function() {      check(app) {        return true;      },      run(app) {        return "hello world";      }    }  }}
  When plugin code is invoked, the plugin object will be this, for example: {  insertText(app) {    return this._text();  },   _text() {    return "hello world";  }} 
  The plugin object will be instantiated when the plugin is installed in the client, retaining any state until it is reloaded (e.g. due to the plugin code being changed in the source note). {  insertText(app) {    this._counter++;    return "hello " + this._counter;  },   _counter: 0,}
  Plugin action functions (both run and check) can return promises, which will be awaited. {  insertText: {    check(app) {      return new Promise(function(resolve) {        setTimeout(resolve, 2000);      }).then(function() {        return true;      });      },    run(app) {      return new Promise(function(resolve) {        setTimeout(resolve, 2000);      }).then(function() {        return "hello world, eventually";      });        }  }}
  Or, they can use async/await syntax: {  insertText: {    async check(app) {      await new Promise(function(resolve) { setTimeout(resolve, 2000); });      return true;    },    async run(app) {      await new Promise(function(resolve) { setTimeout(resolve, 2000); });      return "hello world, eventually";    }  }}
  The first argument passed to a plugin action function is an application interface object that can be used to access settings and call into the host application itself. 
  Accessing settings
  Given a plugin with the following metadata table entry: | setting | API Key |
  A plugin can access the setting through app.settings: {  insertText(app) {    return app.settings["API Key"];  }}
  
  Action function arguments
  For action functions that receive arguments, the app argument will still be the first argument, before any other arguments: {  replaceText(app, text) {    return text + " more";  }}
  When using check and run functions, they will receive the same arguments as the action would. So for the linkOption action, for example: {  linkOption: {    check(app, link) {      return true;    },     run(app, link) {      console.log("Hello!");    }  }}
noteTitle: Plugin Creation: Define settings, name and metadata for a plugin