Part 7 Markdown

Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. Markdown’s simplicity and readability render it attractive for a wide range of writing and documentation tasks. Its flexibility allows it to be extended to suit more complex needs, making it a versatile tool. Created by John Gruber in 2004, its primary purpose is to allow people to write in an easy-to-read and easy-to-write plain text format, which can then be converted to structurally valid HTML (or other formats such as docx or pdf). Markdown is widely used for documentation, web writing, and content creation because of its simplicity and flexibility. Markdown provides an authoring framework for data science as Markdown can produce high quality reports that can be shared with an audience. The advantage of Markdown is that one can use a single Markdown file (or Markdown document) to combine
executable code
code output (such as visualizations and results of calculations)
plain text (to explain, report, and document)
R Markdown documents are fully reproducible and support dozens of static and dynamic output formats. Here are some key points about Markdown:
Simplicity: Markdown syntax is designed to be readable and easy to write. It avoids the complexity of other markup languages, making it accessible even for non-technical users.
Plain Text Formatting: Since Markdown is written in plain text, it can be created and edited in any text editor. This makes it highly portable and version control friendly.
Conversion: Markdown can be easily converted to HTML, making it ideal for web content. Many static site generators and content management systems support Markdown natively.
Extensibility: While the core syntax is intentionally simple, Markdown can be extended with plugins or additional syntaxes for more advanced features like tables, footnotes, and embedded content.
Common Uses of Markdown include, for example, documentation, read-me files, notes, and to-do lists because it is easy to read in its raw form and can be rendered beautifully in web browsers.
Check out this introduction to R Markdown by RStudio and have a look at this R Markdown cheat sheet.
Here’s a guide with commands on the top and their rendered output below.
Table of Contents
Command:
## Table of Contents
- [Headings](#headings)
- [Blockquotes](#blockquotes)
- [Images](#images)
- [Tables](#tables)Rendered:
Emphasis
Command:
Rendered:
Italic text
Italic text
Bold text
Bold text
Bold and italic
Bold and italic
Lists
Blockquotes
Command:
Rendered:
This is a blockquote.
This is a second paragraph within the blockquote.
Blockquotes with Multiple Paragraphs
Command:
> This is a blockquote with multiple paragraphs.
>
> This is the second paragraph in the blockquote.Rendered:
This is a blockquote with multiple paragraphs.
This is the second paragraph in the blockquote.
Blockquotes with Nested Elements
Command:
> ### This is a heading
> - This is a list item within a blockquote
> - Another item
>
> > This is a nested blockquoteRendered:
This is a heading
- This is a list item within a blockquote
- Another item
This is a nested blockquote
Expandable Sections (Details Tag)
Command:
<details>
<summary>Click to expand</summary>
This is the detailed content that is hidden until expanded.
</details>Rendered:
Click to expand
This is the detailed content that is hidden until expanded.Advanced Tables
Command:
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 |
| Row 2 Col 1 | Row 2 Col 2 | Row 2 Col 3 |Rendered:
| Header 1 | Header 2 | Header 3 |
|---|---|---|
| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 |
| Row 2 Col 1 | Row 2 Col 2 | Row 2 Col 3 |
Footnotes
Command:
Rendered:
Here is a simple footnote1 (you can find it at the end/bottom of this document).
Escaping Characters
Command:
Rendered:
Use the backslash to escape special characters: *literal asterisks*
This is the footnote.↩︎