Hi, I wanted to change the font for my code chunks in a distill HTML article. I would like to use a custom font (which I've downloaded from Google Fonts). I've used a custom "style.css" file. In that file I'm typing the following code:
I recently challenged myself to customize a Distill site, which should be similar to customizing the CSS for a Distill article. My site is here, and you can click on the github icon at the top to find the repo:
Here are the relevant lines- they are in my _site.yml but same should work inside the YAML of an article (your CSS filename is in quotes and mine is not, I'm not sure if that is the main difference here?):
Hopefully that gives you enough to get yours going!
Alison
I checked and there's no difference in using the CSS filename in quotes (or not). Your styles.css file is very useful indeed (I checked it out and learned even more customization for the distill article) .
However, what I wanted to change is the font for my printed code chunks, such as this one from your site:
Unfortunately, you didn't customize them, so I can't figure it out from your styles.css file.
Do you happen to know how to do this?
Once again, thank you very much for the help!
My God, you are the absolute best!!! Thank you so much for digging into this. So it looks like I had to use the d-article div.sourceCode code and d-article pre code headers to do that. I was just using: d-code.
Maybe it's because I have a distill article and not a webpage?
I've also tried (unsuccesfully) to change the position of the TOC to the left, and outside of the boxed AUTHOR, PUBLISHED, AFFILIATION headers. Is this again, because you havea webpage and I just have an article?
Did a bit of digging and it sounds like you are running up against something in Distill that has been fixed in the development version available on GitHub, but not yet on CRAN yet. The TOC placement then will also be available to you as well if you update your Distill:
This kind of solved my last problem but now, the update has created two different problems (so sorry to keep asking!). The first issue is that my table of contents gets mixed up with the text (see below):
The other issue is that... before installing the GitHub version, I could format the text code (i.e. text that was wrapped in ``) with the following CSS:
while my code chunks were exempted from such formattings, like so:
But after the update, now my code chunks also follow the above CSS formatting, so my chunks look like:
which is not ideal haha. My question is: is there any way to ONLY format the outside code text? (i.e. text wrapped in `` )?
Once again, thank you so much in advance! Please let me know how I can repay the much-needed help! I could donate to some Patreon account or something!