Skip to content

Repository files navigation

parserino Build & Test

  • HTML5 parser based on 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

LLM-Friendly Documentation

If you are using an LLM (like Gemini, Claude, or ChatGPT) to help you write code with Parserino, you can point it to these files for a concise API overview:

how it works

Check also the examples folder

import parserino;
voidmain()
{
// Parserino will fix your html5Document doc = "<html>my html";
assert(doc.toString() =="<html><head></head><body>my html</body></html>");
// Set a title for your page
doc.title = "Hello world";
assert(doc.toString() =="<html><head><title>Hello world</title></head><body>my html</body></html>");
// Append a html fragment
doc.body.appendChild(` <a href="/first.html">first</a> <div> <a id="tochange" href="/second.html">second</a> </div>`.asFragment // without .asFragment pure text is appended
);
// Create and fill an html elementauto 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 <a> inside a <div>
.frontOrThrow // Take the first element of the range or throw an exception
.innerText="changed!"; // Change the inner textassert(doc.body.byId("tochange").innerText =="changed!");
}

About

A super-fast HTML parser and DOM editor, for D

Topics

Resources

Stars

27 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages