Often in our writing, we need to emphasize certain words or phrases to draw attention to them. In typographic terms, one common way of doing this is by using italics.

In Markdown, italics can be achieved easily. However, there are minor variations in syntax depending on the flavor of Markdown you are using.

Basics of Markdown Italics

Here below is the fundamental syntax for creating italics in markdown:

*italic*

or

_italic_

When you run the above piece of code, expect the below output:

italic

Both asterisks (*) and underscores (_) are used interchangeably and render the same visual output in most flavors of Markdown.

Italics in GitHub-Flavored Markdown (GFM)

If your text is to be viewed primarily via GitHub, it’s important to note that the platform uses an iteration of markdown known as GitHub-Flavored Markdown or GFM.

Here is an example of how you would write italics in GFM:

_this sentence is in italics_

The expected result would be:

this sentence is in italics

Italics in Markdown - Essential Guidelines

Now you know that two ways to write in italics in most Markdown editors is using either a single asterisk (*) or an underscore (_).

However, we need to pay attention to the following essential details when writing:

  1. Avoid Spaces: Ensure there are no spaces between the asterisks or underscores and your text. Spaces will prevent your text from being rendered in italics.

  2. Close the Formatting: Remember to finish your text block with the same symbol you started with. If you open with an asterisk, close with an asterisk; likewise for underscores.

  3. Nested Formatting: If you want to include italics within a stronger emphasis such as bold, the Markdown syntax allows this nesting. See the syntax below:

     **This is a sentence with _italicized words_.**
    

    Which gives this result:

    This is a sentence with italicized words.

Conclusion

Creating italics text in Markdown is a straightforward process whether you use an asterisk or an underscore. Remember to apply the given directives to achieve the perfect italicized text effectively.

Happy Markdown writing!