Formatting Text With Markdown
Markdown provides simple ways to emphasize text, making important information stand out. Common text formatting options are bold and italic.
Bold text
To make text bold, surround it with double asterisks **
or double underscores __
:
**Bold text using asterisks**
__Bold text using using underscores__
When rendered, it will appear as:
Bold text using asterisks
Bold text using using underscores
Italic text
To make text italic, surround it with single asterisks *
or single underscores _
:
*Italic text using asterisks*
_Italic text using underscores_
When rendered, it will appear as:
Italic text using asterisks
Italic text using underscores
Combining bold and italic
You can combine bold and italic formatting by nesting the syntax:
**This sentence is bold and contains *italic* text**
*This sentence is italic and includes **bold** text*
***This entire sentence is both bold and italic***
When rendered, it will appear as:
This sentence is bold and contains italic text
This sentence is italic and includes bold text
This entire sentence is both bold and italic
Additional text formatting
Many Markdown flavors support additional formatting options beyond the basic specification:
Strikethrough
A strikethrough is used to cross out text by adding a line through it. You can add these in Markdown by surrounding text with double tildes ~~
:
~~This text is crossed out~~
When rendered, it will appear as:
This text is crossed out
Highlighting/marking
Some Markdown flavors (like GitHub) support highlighting text by surrounding it with double equal signs ==
:
==This text is highlighted==
Note that this is not universally supported across all Markdown processors.
Subscript and superscript
Some Markdown flavors support subscript and superscript text:
H~2~O (subscript)
X^2^ (superscript)
Again, support for these features varies by Markdown processor. HTML tags are a more universal alternative:
H<sub>2</sub>O
X<sup>2</sup>
Inline code
To format text as code
within a paragraph (inline code), surround it with backticks `
:
There are multiple ways of looping over objects, one is the `for...in` loop.
When rendered, it will appear as:
There are multiple ways of looping over objects, one is the for...in
loop.
For code that includes backticks, you can use double backticks:
`` Use `backticks` within code ``
Escaping special characters
To display a literal character that would otherwise be used for Markdown formatting, place a backslash \
before the character to escape:
\*This text is surrounded by asterisks but is not rendered as italic\*
When rendered, it will appear as:
*This text is surrounded by asterisks but is not rendered as italic*
Characters you can escape include:
\ backslash
` backtick
* asterisk
! exclamation mark
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash symbol
+ plus sign
- minus sign (hyphen)
. dot/period
Combining formatting with links
Text formatting can be combined with links (links are covered in more detail later in the course):
Visit [**Learn-WebDevelopment.com**](https://learn-webdevelopment.com/) to learn about Markdown, web development, and coding.
When rendered, it will display as:
Visit Learn-WebDevelopment.com to learn about Markdown, web development, and coding.