https://github.com/wojtekmach/easyhtml
EasyHTML makes it easy to work with HTML in Elixir.
https://github.com/wojtekmach/easyhtml
Last synced: 6 months ago
JSON representation
EasyHTML makes it easy to work with HTML in Elixir.
- Host: GitHub
- URL: https://github.com/wojtekmach/easyhtml
- Owner: wojtekmach
- License: apache-2.0
- Created: 2022-05-15T22:14:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-31T11:43:32.000Z (9 months ago)
- Last Synced: 2025-03-29T05:08:09.287Z (6 months ago)
- Language: Elixir
- Homepage:
- Size: 30.3 KB
- Stars: 49
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# EasyHTML
[](https://hex.pm/packages/easyhtml)
[](https://github.com/wojtekmach/easyhtml/actions/workflows/ci.yml)EasyHTML makes working with HTML easy.
It is a tiny wrapper around [Floki](https://hex.pm/packages/floki) that adds conveniences:
* An `Inspect` implementation to pretty-print them
* An `Access` implementation to search them
* An `Enumerable` implementation to traverse them
* A `String.Chars` implementation to convert them to text## Usage
```elixir
Mix.install([
{:easyhtml, "~> 0.3.0"}
])doc = EasyHTML.parse!("
Hello, world!
")
#=> ~HTML[Hello, world!
]doc["em"]
#=> ~HTML[world]to_string(doc)
#=> "Hello, world!"import EasyHTML, only: :sigils
doc = ~HTML[
- foo
- bar
Enum.to_list(doc["li"])
#=> [~HTML[
```