https://github.com/trikko/parserino
A super-fast HTML parser and DOM editor, for D
https://github.com/trikko/parserino
dlang dlanguage dom html html5 parser
Last synced: 3 days ago
JSON representation
A super-fast HTML parser and DOM editor, for D
- Host: GitHub
- URL: https://github.com/trikko/parserino
- Owner: trikko
- Created: 2022-05-22T17:05:42.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-09-10T12:47:57.000Z (5 months ago)
- Last Synced: 2025-09-10T16:51:36.644Z (5 months ago)
- Topics: dlang, dlanguage, dom, html, html5, parser
- Language: D
- Homepage:
- Size: 9.36 MB
- Stars: 24
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# parserino [](https://github.com/trikko/parserino/actions/workflows/d.yml)
* HTML5 parser based on [Lexbor](https://github.com/lexbor/lexbor)
* Super-fast parsing & dom editing
* Lazy ranges to browse dom faster.
* Every method is unit-tested on Linux, MacOS, Windows
# documentation
All docs are available [here](https://trikko.github.io/parserino/)
# how it works
Check also the [examples](https://github.com/trikko/parserino/tree/master/examples) folder
```d
import parserino;
void main()
{
// Parserino will fix your html5
Document doc = "my html";
assert(doc.toString() == "my html");
// Set a title for your page
doc.title = "Hello world";
assert(doc.toString() == "Hello worldmy html");
// Append a html fragment
doc.body.appendChild(`
first
`.asFragment // without .asFragment pure text is appended
);
// Create and fill an html element
auto newElement = doc.createElement("a");
newElement.setAttribute("href", "third.html");
newElement.innerText("third");
doc.body.appendChild(newElement);
// You can use selector to select an element
doc
.bySelector("div a") // Select all inside a
.frontOrThrow // Take the first element of the range or throw an exception
.innerText="changed!"; // Change the inner text
assert(doc.body.byId("tochange").innerText == "changed!");
}
```