Project Link
Introduction
Right now if people wants to customize the look of bookdown::gitbook
, they will have to get into the sea of CSS and wish they can find out the correct CSS locator. For example, sometimes the TOC panel is just too wide for me when my TOCs are quite concise while in other cases my short titles are getting just a little too long so it wraps into the second line. In these conditions, I would like to change the width of the TOC panel just by a little. I bet normal people like me will spend at least 30 min on this task. This addin was created to help people solve this kind of common styling need with a peace in mind.
Other than the TOC width problem, it can also help people customize the fonts for Serif and Sans. It also helps people to use google fonts more easily (which requires internet connection). It can also generates codes to adjust line height. Just like some other addins I have created, one key feature of this addin is that it auto-saves users' setting in their home directory so people don't need to type them again and again.
I run out of ideas for this kind of common needs at this moment but I can add more features in the future. I'll appreciate anyone who contribute ideas or even help me code this thing out.
Key technical details:
This is an RStudio addin that uses shiny to create a UI in RStudio. CSS texts are generated using the glue
package and they got wrote into a css file after user clicks the Generate style.css
button. Users current setting is saved to ~/.bdTheme
as in .dcf
format everytime when there is a change inputed.
I got my inspiration from Yihui's comment on this PR: Update style.css to make customizeable by technocrat · Pull Request #630 · rstudio/bookdown · GitHub