Table of contents
- Bold text
- Italicised text
- Apply both bold and italics
- Strikethrough text
- Underline text
- Change the color of a text
- Change text background
This article will discuss a few of Markdown's syntax for formatting text.
Bold text
To make a text bold we place double asterisks at the start and end of the text.
For example:
01: **text in bold**
Italicised text
To italicize text you need to place single asterisks on both sides of the text
For example:
01: *text in italics*
Some Markdown parsers may also accept the underscores _
in place of the asterisks.
For example:
01: _text in italics_
Apply both bold and italics
To apply both bold and italics to any piece of text, place the text between three asterisks at the beginning and end of the text. A combination of both formats is usually used to point out very important information to readers.
For example:
01: ***text in italics***
Strikethrough text
A double tilde ~
symbol is placed on both sides of a text to strikethrough it.
Example:
01: ~~strikethrough~~
Underline text
Unlike applying bold and italics formatting, Markdown does not provide a syntax for underlining text.
Since Markdown is a superset of HTML meaning all Markdown syntax has an equivalent in HTML and all HTML is technically valid Markdown we can use the HTML markup syntax for underline.
Thus:
01: <u>Text to underline</u>
Change the color of a text
Changing the color of text is also one of those things where there is no designated Markdown syntax. In this case we will be relying on both HTML and CSS to achieve this.
We place the text we want to change within an HTML span tag and apply the CSS styling to the span tag.
Example:
01: The word <span style="color:green">Text</span> will be in green
Change text background
Changing the background around a given text is similar to changing the text color itself. In the sense that there is no Markdown syntax for this and we rely on HTML and CSS to achieve this.
01: The background around <span style="background-color:green">Text</span> will be green
Here is another article for you 😊 "The Markdown syntax for adding subscripts"