Closed mihaiconstantin closed 2 years ago
This does not solve the issue. The tidy
utility (i.e., html-tidy.org) still produces a warning when ran against the following HTML
:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
</head>
<body>
<p>
Example of a validation plot:
<div style="text-align: center">
<img src="../help/figures/example-validation.png" style="width: 640px; max-width: 90%;" alt="Example Validation" />
</div>
</p>
</body>
</html>
Namely:
line 12 column 5 - Warning: inserting implicit <p>
The same can be observed from the online HTML
validator at validator.w3.org, which produces:
The issue seems due to placing a div
element inside the p
element. This is not allowed since it is not semantically correct.
One way around this is to replace:
<p>
Example of a validation plot:
<div style="text-align: center">
<img src="../help/figures/example-validation.png" style="width: 640px; max-width: 90%;" alt="Example Validation" />
</div>
</p>
with:
<p>
Example of a validation plot:
<span style="display: block; text-align: center;">
<img src="../help/figures/example-validation.png" style="width: 640px; max-width: 90%;" alt="Example Validation" />
</span>
</p>
Upon submitting to CRAN, the following
NOTE
was produced:The issue seems to be with the
\if{html}{...}
parts in the documentation.Take, for example, the following code (i.e., at 7e068a9) in file
plot-Validation.R
:https://github.com/mihaiconstantin/powerly/blob/7e068a9ff57cdc532413b78f5fff1bd236404261/man-roxygen/plot-Validation.R#L37-L43
First, regenerate the
./man/plot.Validation.Rd
file via, e.g.,devtools::document()
. Then, parse the.Rd
file toHTML
viatools::Rd2HTML("./man/plot.Validation.Rd")
. TheHTML
output looks like this (i.e., indentation preserved):Note that the empty line below the
#' Example of a validation plot:
line confuses the parser, which closes the<p>
tag. Also, according toHTML
semantics it is not valid to have block-level content between<p>...</p>
.The problem seems to go away by removing the empty line mentioned above, which will result in the following
HTML
: