# easyhtml > EasyHTML makes working with HTML easy. ## Docs ### EasyHTML (module) EasyHTML makes working with HTML easy. ### Examples - EasyHTML (module) EasyHTML.from_fragment(" Hello, world ! ") #=> ~HTML[ Hello, world ! ] doc["em"] #=> ~HTML[ world ] import EasyHTML, only: :sigils doc = ~HTML[ foo bar ] Enum.to_list(doc["li"]) #=> [~HTML[ foo ], ~HTML[ bar ]] ### EasyHTML.from_document/1 (function) Parses an HTML document. ### Examples - EasyHTML.from_document/1 (function) iex> EasyHTML.from_document(" Hello, World ! ") |> EasyHTML.to_html() " Hello, World ! " ### EasyHTML.from_fragment/1 (function) Parses a segment of an HTML document. ### Examples - EasyHTML.from_fragment/1 (function) iex> EasyHTML.from_fragment(" Hello, World ! ") |> inspect() "~HTML[ Hello, World ! ]" ### EasyHTML.parse!/1 (function) ### EasyHTML.sigil_HTML/2 (macro) Handles the `~HTML` sigil to create an EasyHTML struct. ### Examples - EasyHTML.sigil_HTML/2 (macro) ~HTML[ Hello, World ! ] ### EasyHTML.text/1 (function) Extracts text. ### Examples - EasyHTML.text/1 (function) iex> EasyHTML.text(~HTML[ Hello, World ! ]) "Hello, World!" ### EasyHTML.to_html/2 (function) Returns HTML string for the given EasyHTML struct. * `:skip_whitespace_nodes` - when `true`, ignores text nodes that consist entirely of whitespace, usually whitespace between tags. Defaults to `true`. ### Examples - EasyHTML.to_html/2 (function) iex> EasyHTML.to_html(~HTML[ Hello, World ! ]) " Hello, World ! " ### EasyHTML.to_string/1 (function) ### EasyHTML.to_tree/2 (function) Builds an Elixir tree data structure representing HTML data. ### Options - EasyHTML.to_tree/2 (function) * `:sort_attributes` - when `true`, attributes lists are sorted alphabetically by name. Defaults to `false`. * `:skip_whitespace_nodes` - when `true`, ignores text nodes that consist entirely of whitespace, usually whitespace between tags. Defaults to `true`. ### Examples - EasyHTML.to_tree/2 (function) iex> EasyHTML.to_tree(~HTML[ Hello, World ! ]) [{"p", [], ["Hello, ", {"em", [], ["World"]}, "!"]}] ## Links - [Online documentation](https://hexdocs.pm/easyhtml)