In some cases, you might want to produce plain Markdown output from R Markdown (e.g., to create a document for a system that accepts Markdown input like Stack Overflow).
To create a Markdown document from R Markdown, you specify the
md_document output format in the front-matter of your document:
--- title: "Habits" author: John Doe date: March 22, 2005 output: md_document ---
By default, the
md_document format produces “strict” Markdown (i.e., conforming to the original Markdown specification with no extensions). You can generate a different flavor of Markdown using the
variant option. For example:
--- output: md_document: variant: markdown_github ---
Valid values are:
markdown(Full Pandoc Markdown)
markdown_strict(Original Markdown specification; the default)
markdown_github(GitHub Flavored Markdown)
markdown_phpextra(PHP Markdown extra)
You can also compose custom Markdown variants. For example:
--- output: md_document: variant: markdown_strict+backtick_code_blocks+autolink_bare_uris ---
See Pandoc’s Manual for all of the Markdown extensions and their names to be used in composing custom variants.
Many popular publishing systems now accept Markdown as input. Table 3.5 shows the correct Markdown variants to use for some popular systems.
In many cases, you can simply copy and paste the Markdown generated by
rmarkdown::render() into the editing interface of the system you are targeting. Note, however, that if you have embedded plots or other images, you will need to upload them separately and fix up their URLs to point to the uploaded location. If you intend to build websites based on R Markdown, we recommend that you use the more straightforward solutions such as blogdown (Xie, Hill, and Thomas 2017; Xie, Dervieux, and Presmanes Hill 2022) as introduced in Section 10 instead of manually copying the Markdown content.
Refer to Section 3.1 for the documentation of other features of Markdown documents, including table of contents (Section 3.1.1), figure options (Section 3.1.5), header and before/after body inclusions (Section 220.127.116.11), Pandoc arguments (Section 18.104.22.168), and shared options (Section 3.1.11).