Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.supernote.com/llms.txt

Use this file to discover all available pages before exploring further.

This API can only be called in NOTE. pngPath must point to an existing, readable image file.
static insertImage(pngPath: string): Promise<APIResponse<boolean>>;
Parameters
ParameterTypeRequiredDefaultDescription
pngPathstringYes-Image file path (must exist and be readable)
Returns
  • APIResponse<boolean>:
    • When success === true, result is true/false indicating whether insertion succeeded
    • When success === false, see error.code / error.message

Example

import { PluginNoteAPI } from 'sn-plugin-lib';

/**
 * Example: insert an image into the current note page.
 */
export async function exampleInsertImage() {
  const pngPath = '/storage/emulated/0/Note/demo.png';

  const res = await PluginNoteAPI.insertImage(pngPath);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'insertImage call failed');
  }

  return res.result;
}