I saw in the html_document
help page an easy-way to customize the anchor style by adapting the anchor-section
class. This works well for individual Rmd documents.
I would like to know how to achieve the same thing within blogdown
. I thought that I could simply customize the static/rmarkdown-libs/anchor-sections/anchor-sections.css
file.
This actually work temporarily, but is not working properly since this file is automatically regenerated every time any Rmd file is rendered.
I'm sorry I did not include a reprex, this is more of a technical question.
static/rmarkdown-libs/
since it is automatically created and will be overwritten, as you have discovered. You need to create another CSS file understatic/
, and include it in one of your (or your theme's) template files in thelayouts/
folder. The precise way to to include it depends on the theme you use. Without a reprex, it's hard to tell you a general solution. You may study this minimal theme to understand how things work: bookdown.org/yihui/blogdown/templates.html and hopefully figure out how to make your custom CSS work with your theme. – Archdiocese/static/css/custom.css
file that I added in my Rmd YAML header withcss: "/css/custom.css"
. This way, I keep your library (the js code is perfect for my need) and I overwrite your style. – Succubus<link rel="stylesheet" href="/css/custom.css">
to the template. – Archdiocese