roxygen2 icon indicating copy to clipboard operation
roxygen2 copied to clipboard

Warning: inserting implicit <strong>

Open danielvartan opened this issue 1 year ago • 2 comments

Hi,

R 4.2.0 switched to HTML5 for documentation pages. It now validates HTML generated from Rd files using HTML Tidy.

Recently, I receive a message from CRAN telling me to fix some issues with my package (mctq) HTML manual version for R-devel builds.

Check issues:

Version: 0.2.0
Check: HTML version of manual
Result: NOTE
    Found the following HTML validation problems:
    fd.html:80:4: Warning: missing </strong> before </p>
    fd.html:81:32: Warning: inserting implicit <strong>
    fd.html:83:1: Warning: inserting implicit <strong>
    gu.html:132:4: Warning: missing </strong> before </p>
    gu.html:133:32: Warning: inserting implicit <strong>
    gu.html:135:1: Warning: inserting implicit <strong>
    gu.html:156:4: Warning: missing </strong> before </p>
    [...]

See the full check at https://cran.r-project.org/web/checks/check_results_mctq.html .

I re-generate the Rd files using the last CRAN version of roxygen2, but that didn't cut it. It appears that the \strong tag, used when something is marked with __ (e.g., __something__), is not rendering well. I think the issue occurs when equations are put as bold, but I'm not sure.

Example:

#' @section Guidelines:
#'
#' Roenneberg, Allebrandt, Merrow, & Vetter (2012) and The Worldwide
#' Experimental Platform (n.d.) guidelines for `fd()` (\eqn{FD}) computation are
#' as follows.
#'
#' __\deqn{FD = 7 - WD}__

Can you guys take a look? Maybe it can be resolved by using \bold instead of \strong.

danielvartan avatar Aug 20 '22 19:08 danielvartan

Yeap, the issue occurs when equations are put as bold. Example:

R file

#' @section Guidelines:
#'
#' Roenneberg, Allebrandt, Merrow, & Vetter (2012) and The Worldwide
#' Experimental Platform (n.d.) guidelines for `fd()` (\eqn{FD}) computation are
#' as follows.
#'
#' __\deqn{FD = 7 - WD}__

Generated Rd file

\section{Guidelines}{


Roenneberg, Allebrandt, Merrow, & Vetter (2012) and The Worldwide
Experimental Platform (n.d.) guidelines for \code{fd()} (\eqn{FD}) computation are
as follows.

\strong{\deqn{FD = 7 - WD}}

Generated HTML file

R CMD Rdconv -t html /path/to/fd.Rd -o fd.html
74: <h3>Guidelines</h3>
75: 
76: <p>Roenneberg, Allebrandt, Merrow, &amp; Vetter (2012) and The Worldwide
77: Experimental Platform (n.d.) guidelines for <code>fd()</code> (<code class="reqn">FD</code>) computation are
78: as follows.
79: </p>
80: <p><strong></p>
81: <p style="text-align: center;"><code class="reqn">FD = 7 - WD</code>
82: </p>
83: </strong>

Check error

Check: HTML version of manual
Result: NOTE
    Found the following HTML validation problems:
    fd.html:80:4: Warning: missing </strong> before </p>
    fd.html:81:32: Warning: inserting implicit <strong>
    fd.html:83:1: Warning: inserting implicit <strong>

danielvartan avatar Aug 20 '22 20:08 danielvartan

This is not a roxygen2 error, it's an error with the html render used in R 4.2.0, but it can cause problems for roxygen2 users.

Changing for \bold, instead of \strong don't fix it...

<h3>Guidelines</h3>

<p>Roenneberg, Allebrandt, Merrow, &amp; Vetter (2012) and The Worldwide
Experimental Platform (n.d.) guidelines for <code>fd()</code> (<code class="reqn">FD</code>) computation are
as follows.
</p>
<p><b></p>
<p style="text-align: center;"><code class="reqn">FD = 7 - WD</code>
</p>
</b>

Maybe, in these cases, roxygen2 could ignore the bold mark.

danielvartan avatar Aug 20 '22 20:08 danielvartan

I'd recommend not bolding your equations 😄

hadley avatar Sep 20 '22 14:09 hadley

Ok. I thought you and the team should know that. Just doing my part.

PS: I don't think is nice to laugh (😄) at someone trying to help you.

danielvartan avatar Jan 11 '23 00:01 danielvartan

That's a smile, not a laugh.

There's nothing we can do to fix the problem as it's a limitation of HTML.

hadley avatar Jan 11 '23 14:01 hadley

That's ok. I understand that it was an honest mistake.

FYI:

A grinning face with smiling eyes (😄) can be interpreted as laughter. GitHub's :smile: is equivalent to that.

See: https://www.merriam-webster.com/dictionary/grin

Is safer to use :smiley: (😃).

danielvartan avatar Jan 11 '23 19:01 danielvartan