api-reference.md

May 26, 2026 ยท View on GitHub

Status

The APIs documented here are the canonical public surface for the current release train.

{% raw %}

@templjs/core

Function References

renderTemplate(template, data, options?)

Renders a template string with structured input data.

import { renderTemplate } from '@templjs/core';

const result = renderTemplate('Hello {{ user.name }}', {
  user: { name: 'Ada' },
});

validateTemplate(template)

Validates template syntax and returns { valid, syntaxDiagnostics }.

import { validateTemplate } from '@templjs/core';

const result = validateTemplate('{% if user %}Hello{% endif %}');

if (!result.valid) {
  console.log(result.syntaxDiagnostics);
}

tokenize(template) and parse(tokens)

Low-level lexer and parser APIs for tooling and diagnostics.

SchemaValidator

Schema-backed data and query-path validation.

import { SchemaValidator } from '@templjs/core';

const validator = new SchemaValidator({
  type: 'object',
  properties: { user: { type: 'object' } },
});

createQueryEngine()

Returns a query engine instance with built-in filter metadata.

extractTemplateScopeBindings(template)

Extracts scope-relevant variable bindings for semantic tooling.

ADRs

@templjs/cli

Render

templjs render -t template.md.tmpl -i data.json

Important flags:

  • --watch
  • --input-format <json|yaml|toml|xml>
  • --output-format <text|json|html|markdown>
  • --json, --quiet, --verbose
  • --no-validate-input, --no-validate-output

Validate

templjs validate -t template.md.tmpl [-s schema.json] [-i data.json]

Init

templjs init -f markdown [-o starter.md.tmpl]

Stability Notes

  • Current package releases are pre-1.0 and move in a shared monorepo release train.
  • Public APIs listed above are the recommended integration surface.

{% endraw %}