R markdown html code_folding problem

rmarkdown
output
documentation
rstudio
html

#1

"code_folding: hide" doesn't work properly on my RStudio Rmarkdown.


title: "Untitled"
author: "Pet"
output:
html_document:
code_folding: hide

This doesn't give proper folding channels on each R script.

It doesn't work at all.


#2

Hi @yulsisdad2, it looks like your code isn't formatted properly for the forum. This might be because you missed an extra backtick when trying to format your code. I've made the same mistake and was pointed to this faq detailing how to properly include code in your post: FAQ: How to make your code look nice? Markdown Formatting

Assuming your code was copied somewhat correctly, it looks like you have incorrect indentation for your YAML header. See how the code is indented with spaces here: https://bookdown.org/yihui/rmarkdown/html-document.html#code-folding

This should work, assuming indentation was the problem:

---
title: "Untitled"
author: "Pet"
output:
  html_document:
    code_folding: hide
---