# addTemplateHash

Wraps the HTML chunks with comments containing the template hash.
This is crucial for hydration to identify which template rendered a section of HTML.

## Signatures

```ts
export declare function addTemplateHash(chunks: ReadonlyArray<HtmlChunk>, { hash }: Template.Template): ReadonlyArray<HtmlChunk>;
```

## Why

Versioned boundary comments let the DOM renderer locate the exact SSR range
corresponding to a compiled template without claiming unrelated nodes.

## Ownership and lifetime

This pure transformation returns a new chunk sequence. Marker adoption and
fallback are owned later by the hydration Scope.

## Examples

```ts
import { addTemplateHash, templateToHtmlChunks } from "@typed/template/HtmlChunk"
import { parse } from "@typed/template/Parser"

const template = parse(["<div>Hello</div>"])
const chunks = templateToHtmlChunks(template)
const chunksWithHash = addTemplateHash(chunks, template)

// chunksWithHash will have template hash comments added
// for hydration purposes
```
