[R-pkg-devel] HTML validation error in roxygen2 generated documentation
Nikos Bosse
n|ko@bo@@e @end|ng |rom gm@||@com
Thu Oct 31 21:32:34 CET 2024
Hi Ivan,
Thanks SO much for your quick help. Removing the <div> did not work. However, I now did
```
#' \if{html}{
#' \out{<div style="text-align: left">}
#' \figure{metrics-binary-point.png}{options: style="width:750px;max-width:100\%;"}
#' \out{</div><p>}
#' Overview of required input format for binary and point forecasts
#' }
```
with an addition <p> and some text, following your suggestion. And that worked like a charm. Also thank your for showing me R CMD Rdconv.
You made my day!
With gratitude and best regards,
Nikos
On 31 Oct 2024 at 19:06 +0100, Ivan Krylov <ikrylov using disroot.org>, wrote:
> В Thu, 31 Oct 2024 18:04:47 +0100
> Nikos Bosse <nikosbosse using gmail.com> пишет:
>
> > Found the following HTML validation problems:
> > ae_median_quantile.html:79:1 (ae_median_quantile.Rd:41): Warning:
> > inserting implicit <p>
> > ae_median_quantile.html:79:1 (ae_median_quantile.Rd:41): Warning:
> > trimming empty <p>
>
> Thank you for providing the links to the source code!
>
> This can be diagnosed using R CMD Rdconv:
>
> R CMD Rdconv -o ae_median_quantile.html -t html ae_median_quantile.Rd
> tidy ae_median_quantile.html >/dev/null
>
> Here are the lines around the problematic part of the HTML document:
>
> -----------------------------------8<-----------------------------------
> <h3>Input format</h3>
>
>
> <div style="text-align: left">
> <p><img src="../help/figures/metrics-quantile.png"
> style="width:750px;max-width:100%;" alt="metrics-quantile.png" /> </div>
>
>
> </p> <!-- here: inserting implicit <p>, trimming empty <p> -->
> -----------------------------------8<-----------------------------------
>
> This </p> is inserted here by Rd2HTML to terminate the paragraph
> started above (I think by \figure if not by \section). Rd2HTML doesn't
> know that you started and ended a <div> before this line, which
> implicitly ended the previous <p>, which makes the present </p> an
> error.
>
> The only way I was able to silence the warning while preserving the
> existing tag structure was to make it \out{</div><p>} to start the new
> paragraph and provide some text for the auto-inserted </p> to finish
> it. Maybe you'll come up with a better fix that doesn't rely on Rd2HTML
> auto-inserting the terminating </p>. I'm not sure, but could it help to
> set style="text-align: left;..." on \figure itself, without the <div>?
>
> --
> Best regards,
> Ivan
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list