Excessibility.HTML (Excessibility v0.5.13)

View Source

HTML parsing, wrapping, and static asset path handling.

This module transforms partial HTML (like LiveView renders or controller responses) into complete, standalone HTML documents suitable for Pa11y analysis.

Responsibilities

  • Wrapping partial HTML in complete document structure
  • Extracting <head> content from the Phoenix endpoint
  • Prefixing static asset paths with file:// for local Pa11y access
  • Removing scripts (which can't execute in static snapshots)

This module is used internally by Excessibility.Snapshot and typically doesn't need to be called directly.

Summary

Functions

Wraps HTML content in a complete document structure if needed.

Types

html_tree()

@type html_tree() :: tuple() | [tuple()]

Functions

wrap(raw_content)

@spec wrap(binary() | html_tree()) :: binary()

Wraps HTML content in a complete document structure if needed.

Accepts either a binary string or a parsed Floki HTML tree. Returns a complete HTML document as a string with proper attributes.