A library for writing, parsing, and manipulating HTML markup as first-class Elixir data structures.
Eml is a library for Elixir that makes HTML markup a first-class citizen in the language. It provides tools to generate, parse, and manipulate HTML using Elixir's data structures and functional paradigms, moving beyond string-based templating to enable more composable and maintainable view logic.
Elixir developers building web applications or tools that require dynamic HTML generation, especially those seeking a more programmatic and type-safe alternative to traditional templating engines.
Developers choose Eml for its deep integration with Elixir, allowing them to leverage pattern matching, protocols, and functional composition for markup, resulting in cleaner and more testable view code compared to string interpolation-based templates.
Library for writing and manipulating (html) markup in Elixir.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
HTML elements are represented as Elixir structs, enabling composition, transformation, and querying using functional patterns, as demonstrated with the Enumerable protocol and Eml.transform/2.
Templates and components support precompilation at compile time, optimizing runtime performance for static content, with examples showing assigns and logic handling.
The Eml.Encoder protocol allows custom data types to be encoded into markup, providing flexibility for domain-specific needs, as illustrated with Map implementations.
Markup trees can be traversed and manipulated using Elixir's Enum functions and dedicated transformation tools, making complex HTML manipulations straightforward.
The custom parser is designed primarily for Eml-generated HTML and fails on non-standard markup like unquoted attributes or improperly closed tags, as admitted in the notes.
Eml does not validate generated HTML for correctness, leaving developers responsible for ensuring validity, which could lead to rendering issues in browsers.
With minimal security safeguards and full access to the Elixir environment, Eml is unsuitable for generating markup from untrusted sources, as noted in the documentation.