Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinsvalin/html_entities
Elixir module for decoding HTML entities.
https://github.com/martinsvalin/html_entities
Last synced: 7 days ago
JSON representation
Elixir module for decoding HTML entities.
- Host: GitHub
- URL: https://github.com/martinsvalin/html_entities
- Owner: martinsvalin
- License: mit
- Created: 2015-07-02T21:36:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-18T21:04:56.000Z (over 3 years ago)
- Last Synced: 2024-10-29T20:37:16.431Z (10 days ago)
- Language: Elixir
- Size: 155 KB
- Stars: 88
- Watchers: 4
- Forks: 24
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Elixir module for decoding HTML entities in a string. (Miscellaneous)
- fucking-awesome-elixir - html_entities - Elixir module for decoding HTML entities in a string. (Miscellaneous)
- awesome-elixir - html_entities - Elixir module for decoding HTML entities in a string. (Miscellaneous)
README
# HtmlEntities
[![Module Version](https://img.shields.io/hexpm/v/html_entities.svg)](https://hex.pm/packages/html_entities)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/html_entities/)
[![Total Download](https://img.shields.io/hexpm/dt/html_entities.svg)](https://hex.pm/packages/html_entities)
[![License](https://img.shields.io/hexpm/l/html_entities.svg)](https://github.com/martinsvalin/html_entities/blob/master/LICENSE)
[![Last Updated](https://img.shields.io/github/last-commit/martinsvalin/html_entities.svg)](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.