-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to extract inner HTML of an element? #212
Comments
I'm just a user, not a maintainer here, but I can at least answer and say that there isn't a good way to achieve this. Everything in lol-html revolves around it being a streaming HTML transformer, and as a result it doesn't hold on to that stream for very long as it passes through. Anything like There are some solutions for inner text, by adding a The only viable path I can think of would be to use the For anything more involved, I'd look at using kuchiki(ki) instead. |
Hello!
I'm trying to use lol_html as an HTML parser to extract all content within an element, it's inner HTML. However I haven't figured out the right methods for this yet. Here is what I want to do, given the following HTML snippet:
I want to extract all the content within the element matching css selector
article#main-content
and store it in a String namedcontent
after this runs the value ofcontent
will be equal to:I've what would be perfect would be a method on the element called
get_inner_content()
there seems to be all the methods for manipulating the inner content but not actually getting it such as:set_inner_content
remove_and_keep_content
Maybe I'm thinking about this wrong, any help just getting the inner content of an element would be so hepful!
The text was updated successfully, but these errors were encountered: