Skip to Content

GitHub Foundations: How to Print Special Characters Like Asterisks and Underscores in Markdown

Learn how to correctly display asterisks, underscores, and other special characters in your Markdown output by escaping them with a backslash. Improve your Markdown formatting skills for the GitHub Foundations certification exam.

Table of Contents

Question

How do you print certain characters, like asterisks (*) and underscores (_), literally on your output?

A. Use three in a row, like *** or ___.
B. Escape them with a backslash, like \* or \_.
C. Unfortunately, this isn’t supported at this time.

Answer

B. Escape them with a backslash, like \* or \_.

Explanation

You can also escape other reserved characters, including { and #, using backslashes.

To print certain characters, such as asterisks (*) and underscores (_), literally in your Markdown output without triggering their special formatting functions, you need to escape them using a backslash (\). By placing a backslash directly before the special character, you tell the Markdown parser to treat the character as a literal rather than interpreting it as a formatting command.

For example, if you want to display an asterisk without causing text to become italicized or bold, you would type \\\*. Similarly, to show an underscore without creating italics or underlined text, you would use \\\_. The backslash signals to the Markdown parser that the following character should be rendered as-is in the output.

Using three asterisks or underscores in a row, like *** or ___, will not achieve the desired result. The Markdown parser will still interpret these as formatting commands, potentially causing unexpected or incorrect output.

In summary, to print special characters like asterisks and underscores literally in your Markdown output, escape them with a backslash. This technique allows you to display these characters without triggering their special formatting functions, ensuring your content appears as intended.

GitHub Foundations certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the GitHub Foundations exam and earn GitHub Foundations certification.