6.6 Embed the Rmd source file in the HTML output file

When you share an HTML output page with others, they may want the Rmd source file, too. For example, they may want to change the Rmd source and compile the report by themselves. You can use the option code_download to embed a copy of the Rmd source file in the HTML output file:

output:
  html_document:
    code_download: true

After the option is turned on, the HTML output page will contain a download button, and readers of the page can hit the button to download the Rmd source file.