How to change colors and attributes of Table of Contents in R Markdown HTML document?

前端 未结 2 676
借酒劲吻你
借酒劲吻你 2021-02-03 15:52

I\'ve spent an inordinate amount of time Google\'ing this and can\'t seem to figure it out.

I am making HTML documents using R Markdown (docs here: http://rmarkdown.rst

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-03 16:25

    You can open the generated html file and study the style elements there: For a simple example like the Rstudio's default which you have shown as an example there are different style elements in the html files such as the ones below. You could change each of these here and I believe you can change any css in markdown like with html. Anything you can do in normal html/css, you should be able to do that in shiny.

    
    
    
    
    
    
    
    
    
    
    
    

    Update You would need a little knowledge of html and css to change the styles and know the styles that are in use. For example, table of contents when ues as toc_float = false is also a link; you can change the color attributes of the link such as below which shows unclicked link, clicked link as green and if you hover over the link, color changes to hotpink. This example to justify any html/css element can be changed in shiny.

    ---
    title: "Untitled"
    output:
      html_document:
        keep_md: true
        toc: true
        toc_float: false
        number_sections: true
    ---
    
    
    

提交回复
热议问题