Skip to content

API

The canonical Go API reference for Quill is pkg.go.dev/github.com/avmnu-sng/quill-template-engine, generated from the exported doc comments and runnable examples. This page is a thin index into it; pkg.go.dev is authoritative for signatures, and this guide site is the narrative layer.

Where to look

  • The facade (quill): Environment, New, NewFromMap, the Render/RenderTo/RenderValues family (each taking a context.Context first), LoadTemplate/CompileString and RenderPrepared for the parse-once/render-many path, the opaque Template, and the Option values (WithAutoescapeHTML, WithStrictVariables, WithCoverage, WithExtensions, WithExtension, WithSandboxPolicy, WithSandboxActive, WithTypes, WithTabWidth, WithCompiled, WithLogger).
  • The value model (runtime): the opaque Value with its Kind() and AsBool/AsInt/AsFloat/AsStr/ AsArray/AsObject accessors, the constructors (Str, Int, Float, Bool, Arr, Null, Safe), the ordered *Array, the Object interface, and FromGo.
  • Loaders (loader): Loader, NewFilesystemLoader, NewArrayLoader, NewChainLoader, NewPrefixLoader, NewFSLoader, NewFuncLoader.
  • Extensions (ext): Filter, Function, Test, Set, Bundle, BaseExtension, and the typed helpers NewFilter, NewFunction, NewTest, NewFilter1.
  • Coverage (cover): Collector, Report, the writers, and MergeReports.
  • The sandbox (sandbox): the opaque Policy, its NewPolicy builder and allow-options (AllowTags, AllowFilters, AllowFunctions, AllowMethods, AllowProperties, Strict, WithTypeGraph), and NewTypeGraph.
  • The type checker (check): Registry, Signature, Type.
  • The compiled-render contract (compiled): the Manifest/Fingerprint contract WithCompiled installs, built with NewManifest/NewFingerprint. The compile-to-Go backend itself is internal; generate a unit with the quill compile command (see the CLI).
  • Errors (errors): the structured error family, including *errors.Security for sandbox violations.

Examples

Runnable ExampleXxx functions in the package populate the Examples tab on pkg.go.dev and double as tests, so the snippets there compile and pass on every build. The guide pages here cross-link into the same API for the mechanism behind each feature:

Stability

From v1.0.0, Quill follows semantic versioning: no exported symbol in the root package or the pkg/ packages changes incompatibly within the v1 series. Error message strings are not part of that contract. Classify a failure by its exported Kind, with errors.As/errors.Is, or against a sentinel such as loader.ErrNotFound, never by matching message text. The engine internals (the lexer, parser, interpreter, and compile-to-Go backend) live under internal/ and are not importable; the quill command's flags, exit codes, and generated-source shape are the compile backend's stable surface. Changes are noted in the Changelog; pin a major version in your go.mod and review the changelog before upgrading.