# `Excessibility.Source`
[🔗](https://github.com/lessthanseventy/excessibility/blob/v0.18.1/lib/source.ex#L1)

Protocol for extracting HTML from various test sources.

Excessibility uses this protocol to support multiple test source types:

- `Plug.Conn` - Phoenix controller test responses
- `Wallaby.Session` - Browser-based feature test sessions
- `Phoenix.LiveViewTest.View` - LiveView test views
- `Phoenix.LiveViewTest.Element` - LiveView test elements

## Extending

To add support for a custom source type, implement this protocol:

    defimpl Excessibility.Source, for: MyCustomSource do
      def to_html(source) do
        # Return HTML string or Floki-parsed tree
        MyCustomSource.get_html(source)
      end
    end

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `to_html`

```elixir
@spec to_html(term()) :: binary() | tuple() | [tuple()]
```

Converts a test source into HTML content.

Returns either a binary HTML string or a Floki-parsed HTML tree.

---

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