-
Notifications
You must be signed in to change notification settings - Fork 9
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
Vignettes: Support figures generated from code #55
Conversation
Ok, so in the vignettes, two different types of image references are created, e.g., ``` r
lavaan_reg(fit.reg, nice_table = TRUE, highlight = TRUE)
```
<img src="../articles/figures/regression_files/figure-gfm/reg-1.png" width="1350" />
``` r
plot(mtcars$mpg)
```
![](C:/github/lavaanExtra/articles/figures/regression_files/figure-gfm/unnamed-chunk-2-1.png)<!-- --> First one now appears correctly, yeah! This is most likely because it uses relative paths because when rendering it actually takes a screenshot of html tables. Second one doesn't work because it produces absolute paths. This is for any regular plot. Absolute paths in rmarkdown rendering seems to be caused by using the
So this should be the solution next. |
…al destination, add vignettes for internal testing [skip ci] because currently breaks tests for mkdocs
So in my new push, I realized that it would be simpler to simply render the vignettes directly inside the However, again, it only works when the URL uses the html form ( # Generated with: plot(mtcars$mpg)
![](articles/figures/vignette_testing_files/figure-gfm/plot-1.png)<!-- -->
# Generated with ![test-logo](hex-conductor.png)
<figure>
<img src="articles/figures/hex-conductor.png" alt="test-logo" />
<figcaption aria-hidden="true">test-logo</figcaption>
</figure>
Yet both paths start with Additionally, this rather substantial change in the vignette generation process broke the |
That sounds reasonable. Just make sure you copy the vignettes and not move them (as suggested above). |
I wasn't really clear in my previous message, but the steps are actually:
So original vignettes are never moved or modified |
Sounds perfect |
Since this vignette is a substantial change, I integrated solution to #56 here (automatic integration of vignettes to navbar). It works! We just have to change the names to what we want, etc. |
cool, just let me know when you need a review. |
It just doesn't work with But not So for It also doesn't work with |
…nette folder when updating docs
… is now automatically updated with vignettes
Ok, I think I fixed all errors, warnings, and notes! And, we have preliminary support for code-generated images! I think I'm ready for you to review this and potentially merge it if all looks OK @vincentarelbundock. Since this issue is becoming quite large, I would transfer the following remaining objectives in new smaller issues:
|
@rempsyc @vincentarelbundock please don't forget to update the NEWS in each PR if there are changes that directly affect the output or that should be visible to users. For example this PR introduces the I have a documentation build failure in |
Sorry, will do. The global option was a "just for me" kind of thing. Do you want it to be user-visible and documented? Could you tell us exactly what commands you run to update the polars website? They way we can test PRs against your workflow before merging PRs. Sorry again for the conflicts. |
I just took this as an example because it was in the first changes I saw in this PR. If you ran into problems running
You need to have a fork of Rscript -e 'altdoc::update_docs(custom_reference = "docs/make-docs.R")'
cd docs && python3 -m mkdocs serve This should provide a link to the preview in the terminal. You might need to build |
Yes, that was exactly my problem. I created a new PR with a documented argument in |
Pretty sure the polar problem is due to the use of the custom_reference argument, probably introduced by the quarto docs PR since I haven’t tested this argument before merging. |
The code for |
In this PR I attempt to solve the code-generated figures issue. I have decided to spend time on this because I think it is a pretty big issue that we will run into later with vignettes (turns out it is not unique to
datawizard
). My previous solution was not working properly.Here I have tried using relative paths as much as possible since this is made possible and encouraged through the previous PR (#50). I feel like I have most of the pieces working: (a) images are moved from e.g.,
docs\articles\regression_files\figure-gfm
todocs\articles\figures\regression_files\figure-gfm
, and (b) md files paths are updated accordingly.Etienne wrote in the code that:
The original URLS in the md files look like this
So I corrected them like this (added
/figures
):But the images are still not detected properly it seems 🤔
Not sure what the link should look like to be properly discovered. The files are in this location. Perhaps the paths need to be absolute rather than relative for the md files, but not sure how to change
rmarkdown::render()
to use absolute paths during rendering?