Skip to content
CAI
Software that uses CAICheck a score

mhanberg/temple

70.2

Strong · 3 October 2026

1.5k

lines of production code

Elixir

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a library that provides a Domain-Specific Language (DSL) for generating HTML templates in Elixir. It compiles template syntax into an Abstract Syntax Tree (AST) to support reusable components with slots and dynamic attributes, replacing a previous macro-based DSL. The system includes tools for converting existing HTML to its syntax and integrates with the Elixir compiler for improved error reporting.

How it got here

2019 — Temple DSL migration and modernization

9 changes.

The project replaced its legacy HTML DSL with the new Temple library, introducing a dedicated macro-based syntax for generating structured markup. This transition involved updating the configuration system to Elixir 1.10+ standards, expanding formatter support for HTML and SVG, and adding comprehensive test coverage and Mix tasks to support the new compilation pipeline.

2020–2023 — AST-based template compilation

4 changes.

The project rewrote its template engine to use an Abstract Syntax Tree (AST) instead of string generation, introducing a new Component API with slots and inner blocks. This architectural shift involved implementing a modular parser and renderer to support dynamic attributes and align with HEEx conventions. Comprehensive test coverage was added to validate the new conversion, parsing, and rendering logic.

Features

Introduces AST-based template compilation and component API

Temple now compiles templates into an Abstract Syntax Tree (AST) rather than generating EEx strings, enabling runtime evaluation of attributes and better integration with LiveView. This change introduces a new Component API (lib/temple/component.ex) for defining reusable UI parts with slots and inner blocks, and adds a Mix task (lib/temple/converter.ex) to convert existing HTML into Temple syntax. The parser (lib/temple/parser.ex) and renderer (lib/temple/renderer.ex) have been rewritten to support this AST pipeline, including handling for SVG, MathML, and various HTML elements.

lib/temple · high confidence

Introduction of Temple DSL for HTML generation

Temple introduces a new DSL for writing HTML templates in Elixir, allowing users to define structured markup using a \temple\ macro that compiles into efficient EEx code. The library supports configuration of the underlying EEx engine (defaulting to Phoenix.HTML.Engine) and provides mechanisms to handle runtime attributes and resolve namespace collisions with existing HTML helpers via aliases. This change replaces the previous Dsl module with the new Temple module, establishing the core syntax and compilation pipeline for template rendering.

lib · high confidence

New Mix tasks for Temple compilation and HTML conversion

The library now includes two new Mix tasks: \mix temple.convert\, which allows users to convert existing HTML files into Temple syntax, and \mix compile.temple\, a compiler task that configures the Elixir compiler to include token metadata, enabling better error reporting and source mapping for Temple templates.

lib/mix · high confidence

Removals

Removal of legacy DSL HTML macro library

The \lib/dsl/html.ex\ module, which provided a DSL for generating HTML via macros like \htm\, \text\, and \deftag\, has been removed. This eliminates the ability to use these specific macro-based helpers for constructing HTML markup within the application.

lib/dsl · high confidence

Behavioural changes

Formatter configuration expanded to support HTML, SVG, and MathML elements

The \.formatter.exs\ file has been significantly updated to include a comprehensive list of HTML, SVG, and MathML tags in the \locals\_without\_parens\ configuration. This ensures that the Elixir formatter correctly handles these template-specific syntax elements without requiring parentheses, aligning the formatting behavior with the library's support for these markup languages.

(repo-wide) · high confidence

Migrate configuration system to Elixir 1.10+ import Config syntax

The application's configuration has been updated to use the modern \import Config\ macro instead of the deprecated \use Mix.Config\. This change updates the main \config/config.exs\ to use \config\_env()\ for environment-specific imports and introduces dedicated \dev.exs\ and \test.exs\ files. The test configuration now explicitly defines aliases for \select\ and \link\ components, ensuring the correct function names are used during testing.

config · high confidence

New AST parser implementation for Temple templates

The \lib/temple/ast\ directory has been completely rewritten with a new modular parser architecture. This change introduces a suite of new modules (such as \AnonymousFunctions\, \Components\, \DoExpressions\, \ElementList\, \Slot\, and \Slottable\) that implement the \Temple.Parser\ behaviour to handle specific template syntax elements. The new implementation adds support for declaring \let!\ parameters on components, handling dynamic attributes, and aligning the component model with HEEx/Surface conventions, fundamentally changing how template code is parsed and processed.

lib/temple/ast · high confidence

Test coverage

Added test support helpers and sample components; Added tests for HTML converter and renderer; Added unit tests for Temple AST node handlers; Initial test suite for Temple and runtime attribute handling; Removed tests for the legacy HTML DSL module.

Dependencies

Temple 0.14.1: Major dependency upgrades and Elixir 1.13 requirement

This release upgrades the project to version 0.14.1 and requires Elixir 1.13 or higher. Key dependency updates include \phoenix\_html\ (upgraded to version 4.1.1, supporting \~\> 3.2 or \~\> 4.0), \floki\ (upgraded to 0.36.2), and \typed\_struct\ (added at 0.3.0). The \ex\_doc\ dependency for documentation generation has also been updated to 0.38.3. These changes reflect a significant shift in the underlying HTML processing and documentation tooling stack.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 69 → 70 (+0.9)
  • Rubric changed (rubric-2026.09.15 → rubric-2026.10.1) — scores are not directly comparable.

Lenses

  • Code Health 99 → 99 (+0.0)
  • Architecture 100 → 100 (+0.1)
  • Maturity 59 → 59 (+0.0)
  • Readiness 67 → 68 (+1.7)
  • Security 82 → 85 (+3.0)

Resolved (2)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

mhanberg/temple was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 3 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 0f66385469146cbf6b111bddf3ff9b06834c9eba — the exact code this score is about.
  • Scored under rubric-2026.10.1 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-8fe32cd45d00.