I know how to edit specific HTML elements using HTMLRewriter. But what I would like to do is e.g.
Add HTML above a specific element, on the condition that a different element is found on the page
Are such operations possible using HTMLRewriter? So far I’ve only found code that explain how to modify individual elements. I have not found any documentation about extracting or moving elements or checking for the existence of particular classes/elements in the entire document.