Skip to main content

String Interpolation

Overview

You can use standard JavaScript string interpolation within np.Templating tags.

For example, using the following in your plugin code, you can provide the referenced fname, mname, and lname variables

export async function templatingInterpolation(): Promise<void> {
try {
const data = { fname: 'Mike', mname: 'Joseph', lname: 'Erickson' }

const result = await NPTemplating.renderTemplate('Test (Interpolation)', data)

Editor.insertTextAtCursor(result)
} catch (error) {
showError(error)
}
}