R markdown: how to change style with css?

I know how to change the R markdown style with a custom css file. However, when the changes are minor, I prefer internal or even built-in css to save problems when managing two files. I googled and did not find a solution for this. Below is a simple example of changing the style using an external css file. Is there a way to do this using internal or embedded css?

R markup file:

---
title: "test"
output: 
    html_document:
        css: test.css
---

## Header 1 {#header1}
But how to change style with internal css?

File test.css:

#header1 {
color: red;
}
+1
source share
1 answer

Markdown accepts the raw HTML and passes it unchanged, so define your "stylized" elements as HTML:

<h2 style="color: red;">Header 1</h2>

, HTML ( - , HTML), .

Markdown, , ( ):

## Header 1 {style="color: red;"}

.

, HTML <style> <head> . HTML-, <style> ( @user5219763 ):

---
title: "test"
output: 
    html_document
---

<style>
    #header1 {
        color: red;
    }
</style>

## Header 1 {#header1}
But how to change style with internal css?
+6

Source: https://habr.com/ru/post/1607486/


All Articles