Open maxdrohde opened 3 months ago
Thanks for the report. I can reproduce this. I'll see this something to fix, or just a conflict between shiny document and code linking - which is done by downlit.
I can confirm this is an issue with downlit processing and shiny prerendered document.
rmarkdown:::shiny_prerendered_extract_context_serialized
are supposed to work on HTML lines. They use regex to extract what they need. downlit::downlit_html_path
on the rendered HTML, but this will read and re-write the document, without keeping the linebreaks. So it breaks the current shiny prerendered processing. Example of content before downlit processing
<!--html_preserve-->
<script type="application/shiny-prerendered" data-context="dependencies">
{"type":"list","attributes":{},"value":[]}
</script>
<!--/html_preserve-->
<!--html_preserve-->
<script type="application/shiny-prerendered" data-context="execution_dependencies">
{"type":"list","attributes":{"names":{"type":"character","attributes":{},"value":["packages"]}},"value":[{"type":"list","attributes":{"names":{"type":"character","attributes":{},"value":["packages","version"]},"class":{"type":"character","attributes":{},"value":["data.frame"]},"row.names":{"type":"integer","attributes":{},"value":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]}},"value":[{"type":"character","attributes":{},"value":["base","cli","compiler","datasets","digest","evaluate","fastmap","graphics","grDevices","htmltools","htmlwidgets","httpuv","jsonlite","knitr","later","lifecycle","magrittr","methods","mime","promises","R6","Rcpp","rlang","rmarkdown","shiny","stats","tools","utils","xfun","xtable","yaml"]},{"type":"character","attributes":{},"value":["4.4.0","3.6.2","4.4.0","4.4.0","0.6.35","0.23","1.2.0","4.4.0","4.4.0","0.5.8.1","1.6.4","1.6.15","1.8.8","1.47","1.3.2","1.0.4","2.0.3","4.4.0","0.12","1.3.0","2.5.1","1.0.12","1.1.3","2.27","1.8.1.1","4.4.0","4.4.0","4.4.0","0.44","1.8-4","2.3.8"]}]}]}
</script>
<!--/html_preserve-->
</main>
<!-- /main column -->
<script id = "quarto-html-after-body" type="application/javascript">
Example after for the same lines
<!--html_preserve-->
<script type="application/shiny-prerendered" data-context="dependencies">
{"type":"list","attributes":{},"value":[]}
</script><!--/html_preserve--><!--html_preserve--><script type="application/shiny-prerendered" data-context="execution_dependencies">
{"type":"list","attributes":{"names":{"type":"character","attributes":{},"value":["packages"]}},"value":[{"type":"list","attributes":{"names":{"type":"character","attributes":{},"value":["packages","version"]},"class":{"type":"character","attributes":{},"value":["data.frame"]},"row.names":{"type":"integer","attributes":{},"value":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]}},"value":[{"type":"character","attributes":{},"value":["base","cli","compiler","datasets","digest","evaluate","fastmap","graphics","grDevices","htmltools","htmlwidgets","httpuv","jsonlite","knitr","later","lifecycle","magrittr","methods","mime","promises","R6","Rcpp","rlang","rmarkdown","shiny","stats","tools","utils","xfun","xtable","yaml"]},{"type":"character","attributes":{},"value":["4.4.0","3.6.2","4.4.0","4.4.0","0.6.35","0.23","1.2.0","4.4.0","4.4.0","0.5.8.1","1.6.4","1.6.15","1.8.8","1.47","1.3.2","1.0.4","2.0.3","4.4.0","0.12","1.3.0","2.5.1","1.0.12","1.1.3","2.27","1.8.1.1","4.4.0","4.4.0","4.4.0","0.44","1.8-4","2.3.8"]}]}]}
</script><!--/html_preserve--></main><!-- /main column --><script id="quarto-html-after-body" type="application/javascript">
We see newlines are lost and this breaks rmarkdown processing.
So this is not directly to Quarto.
code-link
is ignored when shiny document is used. an informative message stating that code-link is not compatible with Shiny.
We've done this. And hopefully this will be fixed in the R packages at some points.
Bug description
When I try to use the
code-link
option with Shiny in Quarto, I get an uninformative error message.Steps to reproduce
Expected behavior
No error, or an informative message stating that
code-link
is not compatible with Shiny.Actual behavior
Your environment
macOS 14.4.1 BuildVersion: 23E224
Quarto check output
❯ quarto check Quarto 1.4.552 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.11: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.4.552 Path: /Applications/quarto/bin
[✓] Checking tools....................OK TinyTeX: (not installed) Chromium: (not installed)
[✓] Checking LaTeX....................OK Using: Installation From Path Path: /Library/TeX/texbin Version: 2023
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK Version: 3.11.3 Path: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 Jupyter: 5.3.0 Kernels: ir, julia-1.6, julia-1.8, julia-1.9, juliapro_v1.5.0-1-1.5, julia-1.5, julia-12-threads-1.8, python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK Version: 4.3.2 Path: /Library/Frameworks/R.framework/Resources LibPaths:
[✓] Checking Knitr engine render......OK