Markdown is platform-independent and can be transported in virtually any application. As a result, it has gained extensive usage in web development such as blogs, documents, notebooks, emails, and etc.
How does Markdown work?
As mentioned, Markdown is a markup language. Therefore, you work in a file ending in .md or .markdown extension. This file contains formatting elements such as headings, code blocks, indentations, alignments, and etc.
The markdown document is processed by an application known as a Markdown processor or parser. The parser then takes the formatted text and produce the document HTML. You can then view the HTML document in a browser or any application that supports it.
The image below illustrates how this process works.
(This image is form Markdown Guide.)
You can learn more about how Markdown works in the resource below:
What is a Markdown Comment?
A Markdown comment refers to a text added to a Markdown file but ignored by the renderer app. Thus, a markdown comment is not displayed in the generated output.
Comments are helpful when you need to include hidden text in your document that is only visible to the document’s author but not exposed on the resulting document.
How to Insert Markdown Comments
Unfortunately, Markdown does not provide native support for comments. However, you can use imported solutions to add comments to your markdown document.
The first syntax for adding a comment in Markdown is placing your comment text inside a pair of square brackets, followed by a colon, a space, and a pound sign.
The syntax is as shown:
The text inside the square brackets is treated as a comment and ignored by the Markdown renderer.
An example is as shown:
This is a paragraph
[this is a comment]: #
The comment above is not visible.
In the example above, we have a simple Markdown syntax with a heading, a paragraph, a comment, and another paragraph.
The syntax below can also insert comments in a Markdown document.
This is regarded as the most platform-compatible format for adding comments.
Another variation of this syntax is:
In some Markdown engines, you can skip the two forward slashes and use the syntax below:
: # "comment text"
: # 'comment text'
You can also include HTML comments in Markdown as illustrated in the syntax below:
Popular Markdown apps support the above method.
Github also allows you to use the syntax below to denote comments:
Although, the above syntax is that it’s not conventionally adopted and used.
In this tutorial, you discovered five effective methods of adding comments to your Markdown comment.