Markdown for GitHub Comments
Format GitHub issue and pull request comments with task lists, code blocks, mentions, and collapsible sections.
Direct answer
GitHub comments use GitHub Flavored Markdown: - [ ] for task lists, triple backticks with a language for code, > for quoting a reply, and a <details> block for collapsible sections. Draft the comment in a live editor first so the formatting is correct before you post it on an issue or pull request.
Open the Markdown EditorWhen to use this
- You are writing a GitHub issue, pull request, or review comment.
- You want a task-list checklist reviewers can tick off.
- You need a collapsible section to hide long logs or output.
Steps
- Use - [ ] for an unchecked task and - [x] for a checked one.
- Wrap code in triple backticks with a language name for syntax highlighting.
- Quote the message you are replying to with a > at the start of the line.
- Hide long output in a <details><summary>Label</summary> ... </details> block.
- Preview the comment in the editor, then paste it into the GitHub box.
Example
## Review checklist - [x] Tests pass - [ ] Docs updated - [ ] Changelog entry added ```bash npm test ``` > Replying to your earlier question about coverage. <details> <summary>Full test log</summary> ``` 42 passing ``` </details>
Review checklist (H2)
[x] Tests pass (checkbox, ticked)
[ ] Docs updated (checkbox, empty)
[ ] Changelog entry added
npm test (highlighted code box)
| Replying to your earlier question about coverage.
> Full test log (click to expand)
42 passingCommon mistakes
- Task list syntax needs a space inside the brackets: - [ ] and - [x], not -[] or -[x].
- Leave a blank line before and inside a <details> block or the Markdown inside it will not render.
- Indenting a code block with four spaces creates a different block; prefer triple backticks with a language.
FAQ
- How do I add a checkbox list in a GitHub comment?
- Start each line with - [ ] for an empty checkbox or - [x] for a checked one. GitHub turns them into clickable checkboxes on issues and pull requests.
- How do I make a collapsible section on GitHub?
- Wrap the content in <details><summary>Label</summary> and </details>. Keep a blank line after the summary so the Markdown inside still renders.
- Does GitHub support the same Markdown as a README?
- Comments and READMEs both use GitHub Flavored Markdown, so tables, task lists, and fenced code work in both. Draft either in a live editor to catch formatting issues first.
Related Markdown guides
Related Markdown editor guides
Markdown Syntax Cheat Sheet
A copy-ready Markdown cheat sheet covering headings, bold, italics, lists, links, images, code, tables, and blockquotes.
How to Write a README in Markdown
Structure a clear README.md with a title, badges, install and usage sections, and a live preview before you commit.
Markdown Table Syntax
Write Markdown tables with pipes and dashes, set column alignment, and keep them readable in the editor before you paste.
Markdown Editor With Live Preview Online
Edit Markdown on the left and see the rendered result on the right in real time, with no login and browser-only drafts.
How to Add Links and Images in Markdown
Add inline links, reference links, and images in Markdown, including titles and clickable image links.
Markdown Task List and Checkboxes
Create checkbox task lists in Markdown for READMEs, GitHub issues, and personal to-do notes with live preview.
Markdown Code Blocks and Syntax Highlighting
Add fenced code blocks with a language for syntax highlighting, plus inline code, in Markdown.