For a project, I would like the knitr-output when choosing for a HTML to enable code folding, but to hide all code when knitting a word document.
My current RMarkdown YAML:
---
title: "Title"
author: "me"
output:
bookdown::html_document2:
code_folding: hide
number_sections: false
word_document:
reference_docx: reference.docx
# Option to hide code in word document?
pdf_document:
latex_engine: xelatex
bibliography: references.bib
link-citations: yes
editor_options:
markdown:
wrap: 72
linestretch: 2
lang: en
---
Is there an option for the word_document
YAML-tag to make this possible? Or another workaround or package? If you set echo=FALSE
or include=FALSE
in the R chuncks, then this also omits the code in the HTML document. Looked around in