AcyOrt provides a helper API that can registers custom functions

const { helper } = acyort

Register custom helper function

acyort.helper.register('_test', function test() {
  return `<p>${acyort.version}</p>`
})

Use it on template

<div>{{ _test() }}</div>

The custom function can access the context of the variable page of the current template rendering.

// output HTML, the data passed is { a: 1 }
acyort.outputHTML({
  template: 'index',
  path: 'index.html',
  data: { a: 1 },
})

// register helper function
acyort.helper.register('_test', function test() {
  // here `this` is the context `page`
  return '<p>${this.a}</p>'
})
<!-- `index` template -->
{{ _test() }}
<!-- result is <p>1</p> -->