R markdown CSS parsing rules

I used a custom CSS style for my R markdown HTML output. I expected the output to simply include the CSS file contents in the head of the HTML file, but the CSS was modified.

For example, any comments were removed. More surprisingly, the CSS embedded some external fonts with @import url(...) and those were embedded directly into the document with data URIs (src: url(data:font/ttf;base64,...). In this particular case, I am very satisfied with the behavior (no external dependencies in the HTML file), but maybe I wanted to keep my file as small as possible.

Is there a way to control how the CSS gets parsed or at least some description of what to expect?

See the book. The yaml headers for css and theme interact.

I have theme set to null, but the CSS is still modified.

According to the book:

If you want to provide all of the styles for the document from your own CSS you set the theme (and potentially highlight ) to null

That implies there should be no alterations.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.