jhy / jsoup

jsoup: the Java HTML parser, built for HTML editing, cleaning, scraping, and XSS safety.
https://jsoup.org
MIT License
10.94k stars 2.19k forks source link

How to parse in-line styles? #1890

Closed ionutg09 closed 1 year ago

ionutg09 commented 1 year ago

Hello,

How can I parse in-line styles?

For example, I have this HTML code:

<p>
      <span style="color: #236fa1;">Testing some styling</span>
      <span style="color: #b96ad9;"> with jsoup </span>
</p>

I am using wholeText() function to convert this HTML to a string, but the result is this one: Testing some styling with jsoup

Is it possible to preserve the CSS styling?

jhy commented 1 year ago

It's not clear to me what you are trying to do. If you are taking plain text, how would the span styles be preserved? What is the output that you want?

This might be better answered on a forum like Stack Overflow. This area is for jsoup bugs and development, not Q&A.

jhy commented 1 year ago

Closing, no response.