JavaFX WebView and markdown rendering...

Kevin Rushforth kevin.rushforth at oracle.com
Sat Jan 6 15:36:53 UTC 2024


I filed https://bugs.openjdk.org/browse/JDK-8323099 to track this bug.

-- Kevin


On 1/6/2024 7:01 AM, Kevin Rushforth wrote:
> Redirecting this discussion to openjfx-dev (which is where it belongs).
>
> -- Kevin
>
>
> -------- Forwarded Message --------
> Subject: 	Re: JavaFX WebView and markdown rendering...
> Date: 	Sat, 6 Jan 2024 06:58:14 -0800
> From: 	Kevin Rushforth <kevin.rushforth at oracle.com>
> To: 	Davide Perini <perini.davide at dpsoftware.org>, 
> openjfx-discuss at openjdk.org
>
>
>
> No, WebView does not render markdown. That is something done on the 
> server. Some websites (e.g., GitHub) will render markdown by 
> generating the appropriate HTML on the fly.
>
> I can reproduce what you are seeing using a GitHub gist containing a 
> simple markdown file:
>
> https://gist.github.com/kevinrushforth/26a76c5ccd2d41df798c2a29542a3414
>
> That page is rendered correctly in Chrome and Firefox. It shows both 
> bold and italic for the last line of text (the one that reads "This is 
> some bold text and some italicized text"). The"GitHub openjdk/jfx" 
> link also works and takes you to the openjdk/jfx repo on GitHub.
>
> When rendered using WebView (on Windows 11 at least), everything is 
> correctly rendered except the bold text. The link works correctly.
>
> I'm not sure where the problem is, but I can file a bug. It might be 
> related to synthetic bolding of text...we've had other bugs in that 
> area in the past. I can't recall whether there are still outstanding bugs.
>
> -- Kevin
>
>
> On 1/6/2024 4:22 AM, Davide Perini wrote:
>> I think that the webview itself is able to turn the markdown into 
>> something that is correctly rendered.
>>
>> [this text](http://acme.org)
>> for example is correctly turned into a clickable link, where the text 
>> of the link is "this text" and the click opens the acme.org website.
>>
>> I'm not really into the webview implementation...
>>
>>
>> Il 05/01/2024 22:34, Tom Eugelink ha scritto:
>>> I'm missing the part on how the markdown is turned into HTML. 
>>> Because the WebView cannot render markdown directly...?
>>>
>>> Bold in HTML is not done using **, it is done with font-weight 
>>> (https://www.udacity.com/blog/2021/01/html-css-font-weight.html) or 
>>> <b> (https://www.w3schools.com/tags/tag_b.asp), so something is 
>>> turning that ** into actual HTML, and that is not working.
>>>
>>>
>>>
>>> On 2024-01-05 18:45, Davide Perini wrote:
>>>> Hi all,
>>>> I have a simple javafx.scene.web.WebView
>>>>
>>>> code is as simple as this:
>>>>
>>>> WebViewwv =new WebView();
>>>> wv.getEngine().load(webUrl);
>>>> Alert alert = createAlert(title, header, alertType);
>>>> alert.getDialogPane().setContent(wv);
>>>> alert.showAndWait();
>>>>
>>>>
>>>> As you can see the webview loads a webUrl, that web url returns a 
>>>> markdown.
>>>>
>>>> Mark down is correctly rendered, I can see correct headings, links 
>>>> are interpreted correctly like links and are clickable, ecc.
>>>> The only things that seems to not work is the bold text.
>>>>
>>>> Bold text **like this** or __like this__
>>>> is interpreted "like this", without the ** or __
>>>> but it's not bold, it is rendered like a normal text.
>>>>
>>>> Any idea on how to fix it? :)
>>>>
>>>> Thanks
>>>> Davide
>>>>
>>>>
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240106/9a54bd3f/attachment.htm>


More information about the openjfx-dev mailing list