-
-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid HTML in prerendered shiny documents #1912
Comments
Hi, thank you for the feedback.
I am not sure to follow here.
Where do you see this invalid html ? I can't reproduce this on my end, but not sure I look in the right place. Can you point me in the correct direction ? |
The steps that work for me to see the invalid HTML are
The difference to the examples you pointed to is that |
I can reproduce this, and the issue was separately reported in rstudio/learnr#498. This issue doesn't visibly impact the page (browsers do everything they can not to fail), but the HTML syntax is invalid: there should be only one |
It's impacting all the prerendered shiny documents. It also has negative impact in terms of SEO |
Thanks for the precisions. I understand now better what is happening. We can't reproduce anymore with the first code above because having a document with With the learn example I could reproduce and look more into it. The fix in #1942 help a lot to see where the issue is. I just want to get to the bottom of it and see if it impacts also Thanks for your patience. |
Yesterday I added one I did not see similar behavior with |
Yes if I add some chunk for server context I can reproduce. This is what I have done this morning to investigate further. This issue is highlighting the fact that using Rmd, a full HTML document is rendered and it should be dealt correctly after. I do not see the same with |
I tried using #1942 but it's a few commits behind master. When I use it with learnr, it returns object 'kbd' not found. I guess it's because 18n_translations has been added recently |
I think For the same reasons though, I think fixing the |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Special comment `<!-- HEAD_CONTENT -->` is now added in `$header-includes$` and there is not need anymore to add it in template. This will make it work with any custom template. As a reminder, this comments is used by htmltools to insert head content - which shiny does for html dependencies found during knitting. They will now be inserted at the same place as with non shiny document. This offers a better fix than #2064 that aimed to be an improvement over #1942 to fix #1912. #2064 workaround is still kept though as safety measure but should not be needed Co-authored-by: Christophe Dervieux <christophe.dervieux@gmail.com>
rmarkdown::run()
on a Rmd document withruntime: shiny_prerendered
serves invalid HTML.Consider the follwing Rmd file invalidhtml/invalidhtml.Rmd with contents
Running this document with
Will serve a document with the follwing invalid HTML (I removed most content for brevity)
The problem is that rmarkdown is rendering the Rmd file to a standalone HTML document, and returning the whole HTML document in the shiny app's UI function. The UI function, however, expects only the body of the document.
I am not sure if this issue has not been discovered until now, or if it's accepted for simplicity (I think most major browsers accept this invalid HTML).
R session info:
By filing an issue to this repo, I promise that
xfun::session_info('rmarkdown')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/rmarkdown')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: