etiennebacher / altdoc

Alternative to pkgdown to document R packages
https://altdoc.etiennebacher.com
Other
62 stars 9 forks source link

Quarto website, is it necessary to delete full folder? #261

Closed kylebutts closed 5 months ago

kylebutts commented 5 months ago

Hi @etiennebacher and @vincentarelbundock. Finally got around to trying out altdoc and I love it.

I'm making a switch for a project I'm working on. There's a few vignettes that take forever to run; the freeze argument is not working for me. This got me debug stepping through the code and I realized that _quarto() is destroyed every time render_docs is run. @vincentarelbundock, could you tell me the rationale of this? Would it be possible to just replace the .qmd files without destroying the whole folder? This would let quarto's internal freeze caching work?

vincentarelbundock commented 5 months ago

I would love for freeze to work in Quarto websites. But the one time I tried I couldn't get it to work, even when leaving the _quarto folder alone. I might have missed something obvious, and I didn't work on this for very long, so it might be an easy fix.

kylebutts commented 5 months ago

@vincentarelbundock I have freeze working perfectly well. I think the problem was that docs/ was created inside of _quarto/ for some reason. Not doing that and not deleting _quarto/_freeze fixes the problem.

I have all the changes implemented in my fork and it works flawlessly with tinyplot and marginaleffects. This change also simplifies the rendering logic by using the output-dir project option to quarto_website.yml:

project:
  type: website
  output-dir: ../docs

This along with not creating the docs/ folder within _quarto allows _freeze be used. So running render_docs() copies all the files it needs to _quarto and renders using quarto render _quarto/. This automatically moves resulting files to docs/.

For current projects, adding output-dir: .../docs makes the new render_docs() changes work. I have tested with tinyplot and marginaleffects. I have an example package you can try: https://github.com/kylebutts/example-altdoc-freeze.


I can submit a PR; but before I do that, I wanted to try and figure out what the defaults should be.

_freeze/ is a bit of an odd feature. Here are details:

This is potentially problematic since any changes to the package that affect output will NOT trigger a rerender.

I think the natural solution is to rerun everything if render_docs(freeze = FALSE). I do not have this implemented yet. I think it can be done with quarto_args argument of quarto::quarto_render() but I'll have to experiment.

vincentarelbundock commented 5 months ago

That sounds awesome! Yesss!

What you propose at the end sounds very reasonable. freeze=FALSE should be default and trigger everything. I think it would feel very unnatural otherwise. That would be more consistent with the "feel" of other output formats within altdoc, even if it isn't exactly what Quarto does.

Ping me when you've put a PR together. I'll try it on a couple more websites and review.

This is going to be a life saver for some of my bigger packages!

etiennebacher commented 5 months ago

Was this resolved by #262 or are there other things to do?