The Wayback Machine - https://web.archive.org/web/20240914065542/https://www.geeksforgeeks.org/markdown-cheat-sheet-github/
Open In App

Markdown Cheat Sheet – GitHub

Last Updated : 02 Sep, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Markdown is a lightweight markup language that allows you to format text using plain text syntax. It is widely used on GitHub for README files, comments, issues, and pull requests, used to create formatted documents without requiring extensive knowledge of HTML or other web technologies.

In this article, we will guide you through the basics and advanced features of GitHub Markdown, helping you use its full potential for your projects.

What is Markdown?

Markdown is a plain text formatting syntax, designed to be easy to read and write. It allows you to format documents using simple syntax that converts to HTML behind the scenes. GitHub has adopted its version called GitHub Flavored Markdown (GFM), which includes additional features designed according to the platform’s needs, such as syntax highlighting for code blocks, tables, and task lists.

Why Use Markdown on GitHub?

Whether you want to update README.md files, write documentation, pull request descriptions, understand projects on GitHub or contribute to any open-source projects understanding markdown is important. Later, It can be easily converted to HTML, providing you with the tools needed for creating visually compelling and well-structured documents.

Now Let’s discuss some Text Formatting Techniques

Basic Text Formatting

Markdown supports basic text formatting to make your content more readable and visually appealing.

1. Headers

Headers are used to define sections and subsections in your document. It is created by using the ‘#’ symbol, a number of ‘#’ symbols indicating the hierarchical level. ‘#’ for Heading level 1, ‘## ‘ for Heading level 2, followed by the header text and so on.

Example:

Screenshot-2024-08-21-200821

Headers in Markdown

2. Emphasis

For emphasizing text by either Italics or bold .

  • Bold and Italic Text:- For italics, you can use asterisks ‘*’ or underscore ‘-‘ around the text. For bold you can use double asterisks ‘**’ or double underscores ‘__’ around the text. you can also combine emphasis for both bold and italics by using triple asterisks ‘***’ or underscores ‘___’ around the text.
Screenshot-2024-08-21-202655

Bold and Italic Text

  • Strikethrough:- For strikethrough, you can use double tildes ‘~~’ around the text.
Screenshot-2024-08-21-203025

Strikethrough

3. Blockquotes

Blockquotes are used to quote text.. This is used for highlighting Important Information or quotes. Begin the line with ‘>’ symbol.

Screenshot-2024-08-21-212022

Blockquotes

Working with Lists

Lists are useful for organizing information in a structured format.

1. Unordered lists

Unordered Lists use asterisks ‘*’ , dashes ‘-‘ or plus ‘+’ .

Example

Screenshot-2024-08-29-180956

Unordered lists

2. Ordered Lists

Ordered Lists use numbers.

Screenshot-2024-08-21-210233

Ordered Lists

3. Nested Lists

For creating a nested list ,you can use combination of ordered and unordered lists.

Screenshot-2024-08-21-210044

Nested Lists

Working with code and syntax highlighting

  • Inline Code: Use backticks `inline code`.
  • Code Blocks: Use triple backticks for Code Blocks or indent the code with four spaces.
  • Syntax Highlighting for various Languages:

For syntax highlighting you can also specify the programming language.

Example

Screenshot-2024-08-21-215738

Working with code and syntax highlighting

These are created using square brackets ‘[ ]’ followed by the parenthesis ‘( )’ .

[Link Text](URL)

Screenshot-2024-08-21-213848

Creating Inline Links

These are created using square brackets and define the reference elsewhere.

[Link Text][Reference]

Screenshot-2024-08-21-213902

Reference Links

3. Linking to Headings and Sections

For linking to the headings or sections, you can use id’s.

Markdown automatically generates the id’s for the headings which can be used in the links. we can do this by

  1. Replace spaces with Hyphens
  2. Convert the heading to lowercase
  3. Remove special characters.

Syntax:

[Link Text][#heading-id]

Example

Screenshot-2024-08-30-215843

Linking to Headings and Sections

Images

Images are similar to links but begin with exclamation mark ‘!’ at the beginning.

  • Embedding Images: Embed the image using this syntax. Alt text is the description of the image that is displayed when the image is not displayed followed by the URL of the image.
Screenshot-2024-08-21-214631

Embedding Images

  • Resizing Images in Markdown: For resizing the image ,you cannot use markdown directly but you can use HTML within markdown.
Screenshot-2024-08-30-221803

Resizing Images in Markdown

  • Linking Images: For making the image a clickable link ,you can use the following syntax.
[![Alt text](image-url)](link-url)

Tables

Tables in Markdown allow you to present data in a structured format.

  • Creating Simple Tables: Pipes’|’ and dashes’-‘ are used for creating tables. Pipes are used to separate columns and dashes are used to create header rows.
Screenshot-2024-08-21-211135

Creating Simple Tables

  • Aligning Table Content: To align the content within the table columns, you can use the colon(‘:’) in the header row:-
  1. Left-aligned: `:—-`
  2. Center-aligned: `:—:`
  3. Right-aligned: `—-`

Example:

Screenshot-2024-08-30-223241

Aligning Table Content

Advanced Text Formatting

Markdown on GitHub supports more advanced formatting options.

  • Task Lists: Simple start a list with -[ ] for Incomplete task or unchecked items and -[x] for complete task or checked items.
Screenshot-2024-08-21-221050

Task Lists

  • Emojis: In, markdown you can use emoji by typing the corresponding shortcode wrapped in colons.

Emojis

This will render as: I am feeling ? today!

  • Mentions(@username) and References(#issue): In GitHub, you can mention users or reference issues directly in markdown.
    • Mentions: Use ‘@username’ to mention a specific user.
    • References: Use ‘#issue-number’ to reference an issue or pull request.

Using HTML in Markdown

Markdown supports basic formatting ,but when you need more control over the layouts you can use html tags within markdown.

Screenshot-2024-08-30-225602

Using HTML in Markdown

  • Combining HTML and Markdown: You can combine HTML and Markdown together as well for better formatting.
Screenshot-2024-08-30-230009

Combining HTML and Markdown

Using Footnotes in GitHub Markdown

Footnotes are used for additional information or references to your text without interrupting the flow of main text .

  • Create the footnote reference: Inside a square bracket, place a carat(^) followed by identifier(number or word) where you want the footnote reference to appear in the text.
  • Define the Footnote: At the end, you can define the footnote with the same identifier inside the square brackets followed by colon(:) ,and then the footnote text.
Screenshot-2024-08-21-225248

Using Footnotes in GitHub Markdown

Special GitHub Features in Markdown

  • GFM(GitHub Flavored Markdown) Enhancements: It extends basic Markdown with additional features.
    • Task Lists
    • Tables
    • Strikethrough
    • Autolinked URLs
  • Table of Contents: Markdown does not support automatic Table of content generation but you can manually create one by linking to headers.
Screenshot-2024-08-30-232906

Table of Contents

  • Autolinked References and URLs: GitHub automatically converts some text patterns into clickable links. Issue or References and URLs.
Markdown-Cheat-Sheet-GitHub

Markdown Cheat Sheet – GitHub



Previous Article
Next Article

Similar Reads

Markdown Cheat Sheet
Markdown is a simple way to write and format text using plain text symbols. It's a lightweight language that lets you create nicely formatted text without the use of complex coding. The idea is to make it easy for people to read and understand the formatting, even if they're looking at the raw text. This cheat sheet will go over some of the key com
6 min read
What is GitHub README File and Markdown?
Documentation is as important as the code itself. Clear, concise, and comprehensive documentation ensures that your project is accessible, understandable, and usable by others. One of the primary tools for this purpose on GitHub is the README file, typically written in Markdown. Let's see more about what a GitHub README file and Markdown are, and w
7 min read
GitHub Relative Link In Markdown File
GitHub is a powerful platform for hosting and collaborating on code repositories, and Markdown files are commonly used for documentation. Using relative links in your Markdown files can help keep your documentation organized and easy to navigate, regardless of the branch or directory structure. This article will guide you through using relative lin
4 min read
jQuery Cheat Sheet – A Basic Guide to jQuery
What is jQuery?jQuery is an open-source, feature-rich JavaScript library, designed to simplify the HTML document traversal and manipulation, event handling, animation, and Ajax with an easy-to-use API that supports the multiple browsers. It makes the easy interaction between the HTML & CSS document, Document Object Model (DOM), and JavaScript.
15+ min read
CSS Cheat Sheet - A Basic Guide to CSS
What is CSS? CSS i.e. Cascading Style Sheets is a stylesheet language used to describe the presentation of a document written in a markup language such as HTML, XML, etc. CSS enhances the look and feel of the webpage by describing how elements should be rendered on screen or in other media. What is a CSS Cheat Sheet? CSS Cheat Sheet provides you wi
13 min read
React Cheat Sheet
React is an open-source JavaScript library used to create user interfaces in a declarative and efficient way. It is a component-based front-end library responsible only for the view layer of a Model View Controller (MVC) architecture. React is used to create modular user interfaces and promotes the development of reusable UI components that display
9 min read
Angular Cheat Sheet - A Basic Guide to Angular
Angular is a client-side TypeScript-based, front-end web framework developed by the Angular Team at Google, that is mainly used to develop scalable single-page web applications(SPAs) for mobile & desktop. Angular is a great, reusable UI (User Interface) library for developers that helps in building attractive, steady, and utilitarian web pages
15+ min read
Bootstrap Cheat Sheet - A Basic Guide to Bootstrap
Bootstrap is a free, open-source, potent CSS framework and toolkit used to create modern and responsive websites and web applications. It is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites. Nowadays, websites are perfect for all browsers and all sizes of screens. What is Bootstrap Cheat Sheet?A
15+ min read
Git Cheat Sheet
Git Cheat Sheet is a comprehensive quick guide for learning Git concepts, from very basic to advanced levels. By this Git Cheat Sheet, our aim is to provide a handy reference tool for both beginners and experienced developers/DevOps engineers. This Git Cheat Sheet not only makes it easier for newcomers to get started but also serves as a refresher
10 min read
HTML Cheat Sheet
HTML (HyperText Markup Language) serves as the foundational framework for web pages, structuring content like text, images, and videos. HTML forms the backbone of every web page, defining its structure, content, and interactions. Its enduring relevance lies in its universal adoption across web development, ensuring that regardless of the framework
15 min read
JavaScript Cheat Sheet - A Basic Guide to JavaScript
JavaScript is a lightweight, open, and cross-platform programming language. It is omnipresent in modern development and is used by programmers across the world to create dynamic and interactive web content like applications and browsers. It is one of the core technologies of the World Wide Web, alongside HTML and CSS, and the powerhouse behind the
15+ min read
How to Upload a Project through GitHub Desktop on GitHub
GitHub Desktop is a user-friendly application that simplifies the process of managing your GitHub repositories on your local machine. If you’re looking to upload a project to GitHub using GitHub Desktop, this guide will walk you through the steps, making the process straightforward and accessible even for beginners. What is GitHub Desktop?GitHub De
3 min read
Introduction to Markdown
If you have ever worked with git platforms like GitHub, BitBucket or Submitted any question or answers to an online forum, chances are you pretty much have unknowingly used Markdown. Markdown is a lightweight markup language. Created by John Gruber in 2004, Markdown is now one of the world’s most popular markup languages. And given below is a detai
3 min read
Primer CSS Markdown
Primer CSS is a free open-source CSS framework built with the GitHub design system to support the broad spectrum of Github websites. It creates the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure that our patterns are steady and interoperable with every other. Its approach to CSS is i
3 min read
Create a Markdown Editor with live preview using React
In this article, we will be creating a Markdown Editor with a live preview using React. I have used easy-to-understand concepts like functional components and hooks, such as useState, to manage our app's data. Plus, we'll use the handy react-markdown npm package to show Markdown content in our editor. Output Preview: Let us have a look at how the f
3 min read
Create a Markdown Editor using React Hooks and CodeMirror
Creating a Markdown Editor with React Hooks and CodeMirror is a great way to build a simple yet powerful text editing tool. CodeMirror is a versatile text editor component that can be easily integrated into React applications. Here's a basic example of how you can create a Markdown editor using React Hooks and CodeMirror: Output Preview: Let us hav
4 min read
How to Change HTML Image Size in Markdown ?
In Markdown, you may often find the need to adjust the size of images within your HTML content. Whether you're working on a blog post, documentation, or any other type of content, resizing images can be crucial for maintaining a visually appealing layout. ApproachThis approach involves directly modifying the <img> tag's attributes within the
2 min read
Explain multi-markdown and its usage
MultiMarkdown is an extended form of Markdown syntax, which is a text-to-HTML conversion syntax tool, that allows web writers to write easy to read and write plain text documents and then convert it into an HTML (or, XHTML) document. The design goal for Markdown syntax is to make the code as readable as possible by formatting out the tags and attri
4 min read
Build a Markdown Previewer
The Markdown Previewer is a simple web application that allows users to input Markdown syntax and preview the rendered HTML output in real-time. This article will cover the implementation of a Markdown Previewer using HTML, CSS, and JavaScript.Markdown is a lightweight markup language that is commonly used for formatting text on the web. Markdown i
4 min read
How to create links with 'target="_blank"' in Markdown ?
In this article, we will see how to create links with 'target="_blank"' in Markdown. Markdown is a free and open-source lightweight markup language that can be utilized to include formatting elements to plaintext text documents. It is a special way to write words that makes them look different on a computer. For instance, you can make some words lo
4 min read
Designing a Markdown note taking application in ReactJS
In this article, we will learn how to design a Markdown note-taking application in React that can help one to quickly jot down notes and download the rendered output. The use of Markdown allows one to spend less time on formatting the text and therefore create rich text content using only the Markdown syntax. Prerequisites:NodeJS or NPMReact JSBoot
4 min read
Flutter - Building and Releasing APK using GitHub Actions
Github Actions is a Github tool that allows users to create CI/CD pipelines directly in a Github project instead of going to a third-party website. It assists us in developing, testing, and releasing our project very conveniently. In this article, we're going to build a workflow for our flutter project. We'll first build the project using the workf
3 min read
How to Clone Android Project from GitHub in Android Studio?
Android Studio provides a platform where one can build apps for Android phones, tablets, Android Wear, Android TV, and Android Auto. Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. One can develop Android Applications using Kotlin or Java as the Backend Language, and it provides XML for developing Fro
3 min read
Using GitHub with SSH (Secure Shell)
Secure Shell (SSH) Protocol facilitates the communication among systems in an unsecured network by providing a secure channel over it. It safeguards the connection to remote servers enabling user authentication. Using SSH, you can connect to your GitHub account eliminating the need of giving username and password each time you push changes to the r
2 min read
How to make “spoiler” text in github wiki pages?
GitHub Wiki pages support GitHub Flavored Markdown. Read more about GitHub flavored markdown here: Mastering MarkdownGitHub Flavored Markdown Spec However, there is no direct method to add a spoiler text in GitHub Flavored Markdown. But, there's a workaround! Approach: Markdown Supports HTML Blocks in it. So, we can use HTML's <details> and
1 min read
How to Trigger WebHooks without Events - Probot Github App
Github is a cloud-based software development website that uses Git as version control. Github is the brand ambassador of open source software development and gives developers the ability to collaborate on software development and host the source code as well. The code is hosted as the content of a repository. As the scope for Github increases, the
3 min read
GitHub App to Build Form using Typeform and Probot
GitHub is a cloud-based software development website that uses Git as version control. Github is the brand ambassador of open source software development and gives developers the ability to collaborate on software development and host the source code as well. The code is hosted as the content of a repository. As the scope for Github increases, the
7 min read
How to Upload Project on GitHub from Pycharm?
PyCharm is one of the most popular Python-IDE developed by JetBrains used for performing scripting in Python language. PyCharm provides some very useful features like Code completion and inspection, Debugging process, support for various programming frameworks such as Flask and Django, Package Management, etc. PyCharm provides various tools for pro
3 min read
Link your GitHub Account with R Studio
R Studio is an integrated development environment(IDE) for R Language. IDE is a GUI, where you can write your quotes, see the results and also see the variables that are generated during the course of programming. R Studio is available as both Open source and Commercial software. It is also available as both Desktop and Server versions and also ava
4 min read
How to get Trending GitHub Repositories Using Node.js ?
Approach: Fetch the entire HTML page and store it as string using request package.Load HTML into cheerio and find the CSS selectors to extract repositories details. Using request package: request package: The request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default. Installing reques
2 min read
Article Tags :