Skip to content

Instantly share code, notes, and snippets.

@jonikarppinen
Last active June 10, 2026 09:11
Show Gist options
  • Select an option

  • Save jonikarppinen/47dc8c1d7ab7e911f4c9 to your computer and use it in GitHub Desktop.

Select an option

Save jonikarppinen/47dc8c1d7ab7e911f4c9 to your computer and use it in GitHub Desktop.
How to comment out stuff in Markdown on GitHub?

Comments in GitHub flavour of Markdown

As answers to this Stack Overflow question reveal, using <!--- and ---> or <!-- and --> works (view source by clicking "Raw"):

Inline comments

How about commenting out <!--- just ---> a part of one line?

If you know of a way, please show me how by cloning this Gist, or commenting below!

Update 2019

As several commenters pointed out, for inline commenting <!-- a normal html comment --> now works.

You can't see this:

Btw, wow, I created this gist in 2014 and only now became aware of the discussion and that it's the top Google hit for markdown comments github. 👍

@benkoshy

Copy link
Copy Markdown
<!---
your comment goes here
and here
-->

Cutting and pasting the SO answer, for easy reference.

@kolakode

Copy link
Copy Markdown

For whole line and multiline comments, this tweak of Rowe's suggestion appears to work for mdcat, VS Code, Gist preview, and online markdown editors I've tried:

[this is a one line comment]: #
   [  it's ok to have 1, 2, or 3 leading spaces  ]: #
but anything else before [ or ]: # after would unhide the comment
as would indenting it 4 or more spaces.

[
this is a
    multiline
comment
]: #

[   as is this compact version
    with no space between `:` and `#`
]:#

  [
    it too can have the `[`
    indented up to 3 spaces
        other line can be indented more
  ]: #

Indenting the [ bracket of the comment 4 or more spaces will make the line be rendered as a pre-formatted block and make the comment visible. Personally, I like the compact version better than the <!-- ... --> for multiline comments, but this trick isn't supported by most syntax highlighters.

@amenity

amenity commented Sep 6, 2022

Copy link
Copy Markdown

Thank you so much @jonikarppinen 🤗 !! Here's hoping Github (along w/ Slack & Zenhub, plz) make their markdown more standard/vanilla/usable so we can all be productive at work.

<!--cc/ @jonikarppinen, in case your two Github handles are not the same. :upside_down_face: -->

@A-Kiwams

A-Kiwams commented Sep 7, 2022

Copy link
Copy Markdown

Works simple

@GoelDarpan

GoelDarpan commented Oct 9, 2023

Copy link
Copy Markdown

Need help - dotnet/docfx#9285

@sienna-jeong

Copy link
Copy Markdown

Is there a keyboard shortcut to do it?

@wxnnvs

wxnnvs commented Feb 27, 2024

Copy link
Copy Markdown

@a-pav

a-pav commented Apr 18, 2024

Copy link
Copy Markdown

I just used this trick in a comment where I thought some details I've wrote might be unnecessary but at the same time I didn't want lose those details, and, I might actually need those in a follow up comment. So I commented them out, now I have access to those by pressing Edit mwahahaha :))

@mfaccin

mfaccin commented Aug 12, 2024

Copy link
Copy Markdown

@ThorondorManwe

ThorondorManwe commented Aug 27, 2024

Copy link
Copy Markdown

Let's see...

Normal text

Markdown comment
Markdown comment text

Normal text


MOre text

@matu3ba

matu3ba commented Apr 10, 2025

Copy link
Copy Markdown

Github comments aka common markdown most portable solution according to https://stackoverflow.com/questions/4823468/comments-in-markdown

(empty line)
[This is a comment]::

Syntax <!--- just ---> is for regular html comments.

Hopefully we get eventually a better standard including strict conforming implementations instead of the markdown mess.

@Big-jpg

Big-jpg commented Jun 25, 2025

Copy link
Copy Markdown

It is still the #1 result on Google in June 2025, turns out simple and accurate information is what people want. huh, who knew!

@hindiworkindia-cpu

Copy link
Copy Markdown

The Samagra ID Download service provided by Government of Madhya Pradesh ensures secure access to identity details. It helps users keep a digital record for easy use in government schemes and services.

@hindiworkindia-cpu

Copy link
Copy Markdown

With Aadhaar Download, users can easily keep a soft copy of their identity card on their mobile or computer. This helps in situations where carrying a physical Aadhaar card is not possible or convenient.

@hindiworkindia-cpu

Copy link
Copy Markdown

Samagra Portal is a very useful online platform that helps citizens access government schemes and services easily. It provides a centralized database for family and individual records, ensuring transparency, efficiency, and proper distribution of benefits to eligible beneficiaries across the state.

@hindiworkindia-cpu

Copy link
Copy Markdown

Online land services are becoming very important for property verification. Platforms like MP Bhulekh, Bhulekh MP, MP Land Record, webgis mp help users access ownership details easily, reducing fraud risks and making the entire process more transparent and user-friendly.

@hanorydixcin-ops

Copy link
Copy Markdown

Through the SSSMID system, eligible citizens can easily connect with various government services such as scholarship programs, pension schemes, ration benefits, and other social support initiatives. By maintaining a single, unified identification system, the Samagra platform improves transparency, efficiency, and accountability in the delivery of public welfare services.

@hindiworkindia-cpu

Copy link
Copy Markdown

Online land services are becoming very important for property verification. Platforms like MP Bhulekh, Bhulekh MP, MP Land Record, webgis mp help users access ownership details easily, reducing fraud risks and making the entire process more transparent and user-friendly.

@muhammadhammad44

Copy link
Copy Markdown

Using a Video Downloader Free of any cost is a fantastic way to build a personal media archive without spending a fortune. This application is capable of handling multiple simultaneous tasks, ensuring that your download queue moves quickly even with a standard internet connection.

@smithh456

Copy link
Copy Markdown

Indiramma Illu 2026 refers to the updated phase of the housing support initiative aimed at improving shelter facilities for low-income and economically weaker families. In 2026, the focus of the scheme continues to be on providing affordable or subsidized housing to eligible beneficiaries, especially those living without permanent homes. The program emphasizes transparency in beneficiary selection, better construction quality, and faster approval processes. Indiramma Illu 2026 is designed to strengthen social welfare by ensuring safe living conditions, improving basic infrastructure, and supporting underprivileged communities in achieving long-term housing security and a better standard of life.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment