How can i add xaringan panelsets to a .rmd/.rmarkdown file in blogdown? - r-markdown

i'm working on a blogdown website and i want to add a xaringan panelset to my index.Rmd file. How can i do this? Do i have to modify the yaml? Sorry for my poor english

Related

"Edit this page" or "View source option" for Jekyll blog post

For my jekyll blog, I'm knitting Rmd to Md for the posts. At somewhere (preferably top), I want to programmatically add a link to view the source page (Rmd) hosted under _sources folder in top level directory.
Similar implementation can be found at https://yihui.org/en/about/ (at the left sidebar- Edit this page option)
Can this be done by some modification in custom knit command?
OR
Some html-include with liquid syntax should be used?
What about this? This has the Github icon, and links to the repo on the github page. Without any reprex, or an example from you, this is the best I can do unless you give more details. Does Jekyll use YAML?
I got this working, so answering my own question
Well in Rmarkdown, we can access the current source file as knitr::current_input().
This can be combined with the url of repository to get the full link to the source file. The best way is to create a new YAML entry as
RmdSource: '_source/`r knitr::current_input()`'
Now to programmatically add the link, either we can use R code with some liquid syntex at the top of the source file OR we can use html-include file inside the current layout file.
I prefer the latter.

TOC problem when knitting Rmarkdown document with images

Finished and published on github my first website using Distill package in RStudio:
https://crlnp.github.io/3-objets.html
On this particular page I include several images in my rmarkdown document and it causes problems with the table of contents: the headings are duplicated and don't follow the headings adequatly. I have tried every toc_float: option available and it does not solve the problem. Aldo tried changing the heading levels (all #, ...). The problem appears wether the image is inserted traditionally or in a code bloc. If I take out the images in my file, the TOC works perfectly. I have not been able to find any information on this issue. Thanks in advance for any help!
Your .Rmd file on the website (GitHub) repo.
If you include JS file (optional) and move wrapping div container, from current position to above your first header, TOC behaviour will change:
<script src="hideOutput.js"></script>
<div class="fold o">
## 1. Les objets
.
.
.
</div>
Is this helpful in any way?
Output:

R Blogdown with different Rmarkdown outputs

I built a blogdown site using Hugo and it has multiple sections, posts all written in Rmarkdown with outputs designed as html_document. It works fine.
In parallel, I designed an HTML dashboard using Rmarkdown with an output designed as flex_dashboard. It generates an HTML file working fine.
I wanted to integrate the dashboard directly within the building of the site but unfortunately by simply adding the Rmarkdown file in the blogdown structure it knits it as an html document and not as a flex_dashboard. So, I have the content within my website but not at all as dashboard but more like a traditional html_document. So no luck with that :(
I tried then copying the dashboard html under /static/html and create a brand new Rmarkdown just invoking my html within an iframe:
---
output: html_document
---
<link rel="preload" href="/html/OpenDashboard.html" as="document">
<iframe width="100%" height="600" name="iframe" src="/html/OpenDashboard.html"></iframe>
Looked good to me and was pretty happy even in inelegant but performance is bad. It takes a long time to load (+10sec) even if the file is not that big (only 6Mb). Size of the html will grow a lot in the future and I can't hope viewers will wait that long.
I read it was possible to clarify the type of knitting we want within a build.R file but I am clueless on how to specify I want html_document knitting for some Rmarkdowns and flex_dashboard for some others.
To answer your last question: in Section 2.7 of the blogdown book, it mentions that you could use blogdown::build_dir() in R/build.R to build arbitrary Rmd files under the static/ directory.

How to disable DOI/URL for bibtex in Rmarkdown

I am using better bibtex and zotero to generate references in rmarkdown.
It works very good except that journal articles and books have an url/doi associated.
My adviser is not too happy about it and I could not figure out how to disable the url/doi in the rmarkdown config or elsewhere.
What I know is that you have to edit your *.csl file (asa.csl, apa.csl or something you use). You could accomplish this very easy by uploading it to this online csl editor. Browse to bibliography/layout/access(macro)/Group/conditional/ and look if there is an URL entry. I got rid of the DOI by setting an option there that the variable should be 'url' AND the document type 'webpage'. Then download the new *csl file, save it to your prefered directory and just knit it. (Look also here with pictures).
Note: Please make rather a safety copy before messing around with your *csl.

Add header to all files created by Unoconv

i am currently triying to create PDF files from different documents always with the same header. I tried using a template in unoconv but it messes all of my document.
I was wondering if anyone knows how to do this?
Thanks for the help!
I solved it.
You need to create an ott file with the header you would like to user and save it as template.ott
Once you have done this you need to change the command for creating PDFs to
unoconv -t template.ott -f pdf name_of_the_file.extension
But be carefull, this ott template only works for doc, docx, and odt.
The presentation files like PPT or PPTX will not work with this template.
You need to generate another template for the presentation files.
Hope this helps someone.....