π Markdown Formatting Characters
Markdown is a lightweight markup language with plain text formatting syntax. It is designed to be easy to read, write, and understand1. Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor2. While Markdown focuses on basic formatting, some platforms and flavors support additional features like subscript, superscript, and even mathematical formulas34.
π Character Formatting
Character | Description | Example Markdown | Example Output |
---|---|---|---|
** or __ | Bold | **This is bold text** | This is bold text |
* or _ | Italic | *This is italicized text* | This is italicized text |
~~ | |||
` | Code | This is code | This is code |
*** | Bold and italic | ***This is bold and italicized*** | This is bold and italicized |
π Headings
To create a heading, add one to six # symbols before your heading text. The number of # you use will determine the size of the heading. Markdown
π Heading 1
π Heading 2
β‘ Heading 3
π§ Heading 4
Heading 5
Heading 6
You can also use an alternative syntax for heading levels 1 and 2:
-
For heading level 1, enter one or more = characters on the line below the heading text.
-
For heading level 2, enter one or more - characters on the line below the heading text2. Markdown
Heading 1
Heading 2
π Paragraphs and Line Breaks
-
To start a new paragraph, leave a blank line between lines of text.
-
To start a new line inside a paragraph, enter two trailing spaces at the end of the line of text. For example: 2
Markdown
This is the first line. This is the second line. This would render as:
This is the first line. This is the second line.
π Thematic Breaks
You can create a horizontal line by placing three or more hyphens, asterisks, or underscores on a line by themselves2. Markdown
*** ___
π Block Quotes
To create a block quote, add a > in front of a paragraph2. Markdown
This is a blockquote. You can also use block quotes to quote an email or a tweet:
βHi there,
How are you doing today?
Best regards,
John Doeβ
π Lists
To create an unordered list, start each line with a -, *, or +2. Markdown
-
First item
-
Second item
-
Third item
To create an ordered list, start each line with a number and a period2. Markdown
1. First item 2. Second item 3. Third item
You can nest lists within lists by indenting the nested list items with two spaces2. Markdown
-
First item
-
Nested item
-
Another nested item
-
Second item
You can also use blank lines within list items to create paragraphs2. Markdown
- First item
This is a paragraph within the first list item.
- Second item
π Code Blocks
To create a code block that spans multiple lines, indent each line by four spaces or one tab2.
π code block
print β3 backticks orβ print βindent 4 spacesβ
Alternatively, you can use fenced code blocks by adding three backticks (```) or tildes (~~~) on the lines before and after the code block2.
π code block
print β3 backticks orβ print βindent 4 spacesβ
You can also use fenced code blocks with syntax highlighting by specifying the language after the opening backticks6. Java
public class Main { public static void main(String args) { System.out.println(βHello, world!β); } }
To escape backticks within a code block, you can use more backticks to enclose the code block7. For example:
This is a code block with a backtick (`) inside.
π Tables
To create tables in Markdown, use vertical bars (|) to separate columns and hyphens (-) to create the header row2.
Header 1 | Header 2 |
---|---|
Row 1, Cell 1 | Row 1, Cell 2 |
Row 2, Cell 1 | Row 2, Cell 2 |
To escape pipe characters in tables, use its HTML character code (|)3.
π Links
To create a link, enclose the link text in brackets (β) and then enclose the URL in parentheses (())2. Markdown
You can also add a title to a link by putting the title in quotes after the URL2. Markdown
(https://www.google.com βGoogleβs Homepageβ)
To create a link to a section within a document, use the section heading as the link text and add a # symbol followed by the section heading (with spaces replaced by hyphens) to the URL8. Markdown
(#link-to-heading)
This can be useful for creating a table of contents or for linking to specific parts of a long document.
π Images
To add an image, add an exclamation mark (!), followed by alt text in brackets (β), and the image URL in parentheses (())2. Markdown
!(image.jpg)
You can also add a title to an image by putting the title in quotes after the URL2. Markdown
!(image.jpg βAn image of a catβ)
π Backslash Escapes
You can escape characters that have a special meaning in Markdown syntax by adding a backslash () in front of them2. For example, to display an asterisk (*) literally, you can use:
Markdown
\This is not italic\
π Variations in Markdown
Markdown is not a formally standardized language, so the way it is interpreted can vary slightly across different platforms9. However, most Markdown processors support the basic syntax described above. Some of the most common Markdown flavors include:
-
CommonMark: A standardized specification of core Markdown features, designed to improve consistency across different Markdown processors10.
-
GitHub Flavored Markdown (GFM): A variant of Markdown used on GitHub, with features like tables, task lists, and auto-linked URLs10.
-
Markdown Extra: An extension of Markdown with features like tables, definition lists, and footnotes10.
-
MultiMarkdown: An extension of Markdown with advanced features for creating more complex documents, such as academic papers and books10.
π Conclusion
Markdown provides a simple and efficient way to format text. By understanding the basic Markdown syntax and its variations, you can create well-formatted documents, messages, and web pages. Markdownβs emphasis on readability and ease of use makes it a popular choice for a wide range of writing tasks15. Furthermore, Markdown is a portable format, meaning that Markdown files can be opened and edited in virtually any text editor, making it a future-proof format for writing11.
π§ Works cited
1. Basic Syntax - Markdown Guide, accessed on January 27, 2025, https://www.markdownguide.org/basic-syntax/
2. Markdown Syntax | Hub Documentation - JetBrains, accessed on January 27, 2025, https://www.jetbrains.com/help/hub/markdown-syntax.html
3. Extended Syntax - Markdown Guide, accessed on January 27, 2025, https://www.markdownguide.org/extended-syntax/
4. What does $$ do in Rstudio markdown document? - Stack Overflow, accessed on January 27, 2025, https://stackoverflow.com/questions/39466662/what-does-do-in-rstudio-markdown-document
5. Markdown Basics - Daring Fireball, accessed on January 27, 2025, https://daringfireball.net/projects/markdown/basics
6. enterprise.github.com, accessed on January 27, 2025, https://enterprise.github.com/downloads/en/markdown-cheatsheet.pdf
7. How to put (in markdown) an inline code block that only contains a backtick character, accessed on January 27, 2025, https://stackoverflow.com/questions/55586867/how-to-put-in-markdown-an-inline-code-block-that-only-contains-a-backtick-char
8. Comments in Markdown - syntax - Stack Overflow, accessed on January 27, 2025, https://stackoverflow.com/questions/4823468/comments-in-markdown
9. Basic writing and formatting syntax - GitHub Docs, accessed on January 27, 2025, https://docs.github.com/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
10. Variants and Flavors of Markdown - Luis Llamas, accessed on January 27, 2025, https://www.luisllamas.es/en/markdown-flavors-and-variants/
11. Getting Started | Markdown Guide, accessed on January 27, 2025, https://www.markdownguide.org/getting-started/