Skip to main content
In this lesson you’ll learn how GitHub’s slash commands speed up composing rich Markdown content—such as alerts, code fences with syntax highlighting, collapsible details, and tables—without typing all the Markdown or HTML manually. Slash commands are available where the editor accepts rich issue/PR/discussion content (issues, pull requests, and discussions). They are not available in static README editors.
Slash commands work in Issues, Pull Requests, and Discussions. They are not available in static README Markdown editors.
How to open the slash menu
  • Create a new issue, a pull request body, or a discussion comment.
  • Type a forward slash (/) to open the slash menu. The editor will display quick inserts such as Alerts, Code block, Details, Saved replies, Templates, and Table.
  • Choose an item from the menu to insert a fully-formed snippet you can edit.
The image shows a GitHub interface where a new issue is being created with a title "exploring slash commands" and a description containing an alert message. There's a dropdown menu for slash commands with options like Alerts and Code block.
Common slash-command inserts Below is a concise overview of common slash-command inserts you’ll encounter and how to use them. Examples Alerts
  • The Alerts insert creates a prominent message block. A portable Markdown pattern for a warning is a blockquote with bold text and an emoji:
Code blocks
  • The Code block insert produces a fenced code block with a language option so the editor can highlight syntax. Example JavaScript:
Details (collapsible content)
  • The Details insert adds an HTML <details> block. This is supported in GitHub-flavored Markdown and is useful for hiding long sections until the reader expands them:
Tables
  • The Table insert prompts you for the number of columns and rows, then inserts a Markdown table skeleton. Replace headers and cells with your values. Example 4×4 table:
Other useful inserts
  • Saved replies and Templates let you quickly reuse structured content across issues, PRs, and discussions—helpful for maintaining consistent responses and reducing repetitive typing.
Best practices and tips
  • Use the slash menu to avoid manually typing fences, alignment pipes, or HTML tags.
  • Combine inserts: for example, put a code block inside a Details block to hide long examples.
  • Review and edit the inserted snippet—slash commands provide a starting point that you can tailor to your needs.
Links and references

Watch Video

Practice Lab