# HtmlEntities
[](https://hex.pm/packages/html_entities)
[](https://hexdocs.pm/html_entities/)
[](https://hex.pm/packages/html_entities)
[](https://github.com/martinsvalin/html_entities/blob/master/LICENSE)
[](https://github.com/martinsvalin/html_entities/commits/master)
Elixir module for decoding and encoding HTML entities in a string.
Entity names, codepoints and their corresponding characters are copied from
[Wikipedia](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references).
## Installation
Add the dependency to your `mix.exs` file, then run `mix deps.get`.
```elixir
defp deps do
[
{:html_entities, "~> 0.5"}
]
end
```
## Usage
Inside IEx:
```elixir
iex> HtmlEntities.decode("Tom & Jerry")
"Tom & Jerry"
iex> HtmlEntities.decode("¡Ay, caramba!")
"¡Ay, caramba!"
iex> HtmlEntities.encode("<< KAPOW!! >>")
"<< KAPOW!! >>"
```
Inside a module:
```elixir
defmodule EntityTest do
def non_breaking_space do
HtmlEntities.decode("¡")
end
end
```
## License
Copyright (c) 2015 Martin Svalin
This library is MIT licensed. See the [LICENSE](https://github.com/martinsvalin/html_entities/blob/master/LICENSE) for details.