templ.js

@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, errors? }.

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

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

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.templ -i data.json

Important flags:

Validate

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

Init

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

Stability Notes