<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Redirecting this discussion to openjfx-dev (which is where it
    belongs).<br>
    <br>
    -- Kevin<br>
    <div class="moz-forward-container"><br>
      <br>
      -------- Forwarded Message --------
      <table class="moz-email-headers-table" cellspacing="0" cellpadding="0" border="0">
        <tbody>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Subject:
            </th>
            <td>Re: JavaFX WebView and markdown rendering...</td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Date: </th>
            <td>Sat, 6 Jan 2024 06:58:14 -0800</td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">From: </th>
            <td>Kevin Rushforth <a class="moz-txt-link-rfc2396E" href="mailto:kevin.rushforth@oracle.com"><kevin.rushforth@oracle.com></a></td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">To: </th>
            <td>Davide Perini <a class="moz-txt-link-rfc2396E" href="mailto:perini.davide@dpsoftware.org"><perini.davide@dpsoftware.org></a>,
              <a class="moz-txt-link-abbreviated" href="mailto:openjfx-discuss@openjdk.org">openjfx-discuss@openjdk.org</a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      
      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.<br>
      <br>
      I can reproduce what you are seeing using a GitHub gist containing
      a simple markdown file:<br>
      <br>
      <a class="moz-txt-link-freetext" href="https://gist.github.com/kevinrushforth/26a76c5ccd2d41df798c2a29542a3414" moz-do-not-send="true">https://gist.github.com/kevinrushforth/26a76c5ccd2d41df798c2a29542a3414</a><br>
      <br>
      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.<br>
      <br>
      When rendered using WebView (on Windows 11 at least), everything
      is correctly rendered except the bold text. The link works
      correctly.<br>
      <br>
      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.<br>
      <br>
      -- Kevin<br>
      <br>
      <br>
      <div class="moz-cite-prefix">On 1/6/2024 4:22 AM, Davide Perini
        wrote:<br>
      </div>
      <blockquote type="cite" cite="mid:a7104eb8-4e27-4f9e-9d62-72f280b43474@dpsoftware.org">
        I think that the webview itself is able to turn the markdown
        into something that is correctly rendered.<br>
        <br>
        [this text](<a class="moz-txt-link-freetext" href="http://acme.org" moz-do-not-send="true">http://acme.org</a>)<br>
        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.<br>
        <br>
        I'm not really into the webview implementation...<br>
        <br>
        <br>
        <div class="moz-cite-prefix">Il 05/01/2024 22:34, Tom Eugelink
          ha scritto:<br>
        </div>
        <blockquote type="cite" cite="mid:1631f5da-b658-4240-a1f9-fc86e746d479@tbee.org">
          <div class="moz-cite-prefix">I'm missing the part on how the
            markdown is turned into HTML. Because the WebView cannot
            render markdown directly...?</div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix">Bold in HTML is not done using
            **, it is done with font-weight (<a class="moz-txt-link-freetext" href="https://www.udacity.com/blog/2021/01/html-css-font-weight.html" moz-do-not-send="true">https://www.udacity.com/blog/2021/01/html-css-font-weight.html</a>)
            or <b> (<a class="moz-txt-link-freetext" href="https://www.w3schools.com/tags/tag_b.asp" moz-do-not-send="true">https://www.w3schools.com/tags/tag_b.asp</a>),
            so something is turning that ** into actual HTML, and that
            is not working.</div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix"><br>
          </div>
          <div class="moz-cite-prefix">On 2024-01-05 18:45, Davide
            Perini wrote:<br>
          </div>
          <blockquote type="cite" cite="mid:0101ccd5-7a22-4972-a8a8-df2d13323211@dpsoftware.org"> Hi all,<br>
            I have a simple javafx.scene.web.WebView<br>
            <br>
            code is as simple as this:<br>
            <br>
            <div style="background-color:#1e1f22;color:#bcbec4">
              <div style="background-color:#1e1f22;color:#bcbec4">
                <div style="background-color:#1e1f22;color:#bcbec4">
                  <pre style="font-family:'JetBrains Mono',monospace;font-size:9,8pt;">WebView <span style="color:#c77dbb;">wv </span>= <span style="color:#cf8e6d;">new </span>WebView();
<span style="color:#c77dbb;">wv</span>.getEngine().load(webUrl);
</pre>
                  <div style="background-color:#1e1f22;color:#bcbec4">
                    <pre style="font-family:'JetBrains Mono',monospace;font-size:9,8pt;">Alert alert = createAlert(title, header, alertType);
alert.getDialogPane().setContent(<span style="color:#c77dbb;">wv</span>);
alert.showAndWait();

</pre>
                  </div>
                </div>
              </div>
            </div>
            <br>
            As you can see the webview loads a webUrl, that web url
            returns a markdown.<br>
            <br>
            Mark down is correctly rendered, I can see correct headings,
            links are interpreted correctly like links and are
            clickable, ecc.<br>
            The only things that seems to not work is the bold text.<br>
            <br>
            Bold text **like this** or __like this__<br>
            is interpreted "like this", without the ** or __<br>
            but it's not bold, it is rendered like a normal text.<br>
            <br>
            Any idea on how to fix it? :)<br>
            <br>
            Thanks<br>
            Davide<br>
            <br>
            <br>
            <br>
            <br>
          </blockquote>
          <p><br>
          </p>
        </blockquote>
        <br>
      </blockquote>
      <br>
    </div>
  </body>
</html>