Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lpil/javascript-dom-parser
https://github.com/lpil/javascript-dom-parser
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/lpil/javascript-dom-parser
- Owner: lpil
- Created: 2024-04-07T13:13:24.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-07T13:28:19.000Z (7 months ago)
- Last Synced: 2024-08-04T04:07:37.844Z (3 months ago)
- Language: Gleam
- Size: 7.81 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-gleam - javascript_dom_parser - [📚](https://hexdocs.pm/javascript_dom_parser/) - Bindings to the JavaScript DOMParser API (Packages / JavaScript)
README
# javascript_dom_parser
Bindings to the JavaScript `DOMParser` API.
[![Package Version](https://img.shields.io/hexpm/v/javascript_dom_parser)](https://hex.pm/packages/javascript_dom_parser)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/javascript_dom_parser/)```sh
gleam add javascript_dom_parser
```
```gleam
import javascript_dom_parserpub fn main() {
let html = "Hi!
How are you?
"
javascript_dom_parser.parse_to_records(html)
}
```
This function will return a data structure like so:
```gleam
Element("HTML", [#("lang", "en")], [
Element("HEAD", [], [
Text("\n "),
Element("TITLE", [], [Text("Hi!")]),
Text("\n"),
]),
Text("\n"),
Element("BODY", [], [
Text("\n "),
Element("P", [#("style", "color: #ffaff3")], [Text("How are you?")]),
Text("\n "),
Comment(" Wooo coding! "),
Text("\n\n"),
]),
])
```Further documentation can be found at .