Closed IULibScholComm closed 1 year ago
Thanks for sharing the repository. I can reproduce on your project.
I see this browser console error on your website
VM1504:1 Uncaught SyntaxError: Unterminated string in JSON at position 10000000
at JSON.parse (<anonymous>)
at htmlwidgets.js:646:27
at Array.forEach (<anonymous>)
at forEach (htmlwidgets.js:55:14)
at htmlwidgets.js:574:7
at Array.forEach (<anonymous>)
at forEach (htmlwidgets.js:55:14)
at window.HTMLWidgets.staticRender (htmlwidgets.js:572:5)
at maybeStaticRenderLater (htmlwidgets.js:697:26)
at HTMLDocument.<anonymous> (htmlwidgets.js:704:7)
So I believe there is indeed something related to the number of point. If I reduce T=
value, we see that the plotly graph is working correctly.
If we look at the HTML source for the plotly element we can see the data, it starts like this
<figure class="figure"><div class="plotly html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-29617411b776018e6e4e" style="width:100%;height:464px;"></div>
<script type="application/json" data-for="htmlwidget-29617411b776018e6e4e">{"x":{"data":[{"
and indeed at the end we can see
17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,17500,</script></figure>
</div>
</div></section></section></main>
</div>
<script src="site_libs/quarto-html/zenscroll-min.js"></script>
</body></html>
So two conclusion:
why-sex.qmd
does contain other contentIf I reduce the number of points, then the data is complete and the document contains the end of the plotly part + the rest of content
There is indeed an error somewhere in the processing. I am looking into this. It does not seem to happen in a single doc, or simpler project... 🤔
Ok so investigation leads to
code-link: true
Set it to false it should solves this.
code-link: true
will trigger a processing of the HTML file by downlit R package. And the issue is there as the returned HTML is truncated. Something is not working as expected.
I'll open an issue in downlit and will link here.
Thanks a lot for the report ! We would not have found this without your report.
See the rest of investigation at https://github.com/r-lib/downlit/issues/172
The issue is definitely with how downlit is working. The HTML produced with this plotly graph is creating a HTML <script>
node with a very long JSON data in it. It is 12950084
characters ( bytes here) long, which is more than the hardcoded limit of libxml2
parser used by downlit through xml2 R package. Setting an option for xml2 can remove this constraint and will make things work, but there is no way currently to pass such option to xml2 from your code.
I don't know what Quarto could / should do here. We could try to check for such content and not run downlit on this file.
But it seems to me something than downlit should deal with 🤔
Bug description
Dear Quarto Team, I am writing on behalf of an author whose book I am publishing in Quarto. His R-Plotly plot--two line plots with an interactive slider--is not being rendered in the HTML version of the Quarto book (though it is rendered in the Quarto book's PDF, DOCX, and EPUB versions); instead, the HTML just stops--the plot and all the text after it do not get rendered.
May I ask for your help with solving this? (Please note: I am a beginner with software, programming, etc.)
I believe the R code is error-free (it runs fine in RStudio); my hunch however is that the data produced by the r code may be too large. If so, then I would also welcome advice on how to fix this. Thank you! Adam
Steps to reproduce
https://iulibscholcomm.github.io/through-the-looking-glass/why-sex.html https://github.com/IULibScholComm/through-the-looking-glass