# `Juggernaut.Report.Html`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/report/html.ex#L1)

The dashboard page (`mix juggernaut.report`, design notes §11): one HTML file holding its
styles, its script and its data (`Juggernaut.Report.Data`) inline. A Content Security
Policy forbids every network request, so the page works offline and leaks nothing.

The data sits in `<script type="application/json" id="juggernaut-data">`, encoded so
that no text inside it can end the element: Jason's `:html_safe` escape (`/` as `\/`)
plus every `<` as `\u003c` (deps:jason).

Pages, each a `<section>` by id: `overview`, `codemap`, `inspector`, `tests`,
`performance`. The location hash picks one (`#inspector/<hash>` opens a mutant);
`?theme=light|dark` forces a theme, otherwise the viewer's preference applies.

# `encode`

```elixir
@spec encode(term()) :: String.t()
```

`data` as JSON that is safe inside a `<script>` element: invalid UTF-8 replaced, `/`
escaped and every `<` written as `\u003c`. It decodes to the same document.

# `escape`

```elixir
@spec escape(String.t()) :: String.t()
```

Escapes text for HTML element content and attribute values.

# `pages`

```elixir
@spec pages() :: [String.t()]
```

The page ids, in navigation order.

# `render`

```elixir
@spec render(map()) :: iodata()
```

The page for the data document `data`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
