Using Markdown for Documentation on GitHub

Markdown is a lightweight markup language that converts text to valid HTML. It is widely used to create README.md, CONTRIBUTING.md, and other project documents hosted on GitHub. Using Markdown is essential for developers and teams who want to maintain clear, efficient, and easy-to-maintain documentation.

Why use Markdown?

Markdown allows users to focus on the content of the document rather than its formatting. The syntax is simple and allows documents to be easily read in their raw form and rendered elegantly by GitHub. This makes Markdown ideal for documenting software projects, where clarity and simplicity are key.

Basic Markdown Syntax

To create titles, Markdown uses the # symbol followed by the title text. One # represents a title for level one (h1), two ## for level two (h2), and so on up to six ##### # for a level six (h6) title.

To format text, Markdown offers several options:

  • Bold text is made with two asterisks or underlines before and after the text: **bold** or __bold__.. li>
  • Text in italic is done with an asterisk or underline before and after the text: *italic* or _italic_.
  • The scratched is made with two tildes before and after the text: ~~scratched~~.
  • Inline code is indicated by backticks: `codigo`.

Lists can be created using asterisks, plus signs or hyphens for unordered lists, and numbers followed by a period for ordered lists:

  • - Item 1
  • + Item 2
  • * Item 3

For ordered lists:

  1. 1. First item
  2. 2. Second item

Links are created with the link text in square brackets and the URL in parentheses: [GitHub](https://github.com).

Images are similar to links, but begin with an exclamation point, followed by alt text in square brackets and the image URL in parentheses: ![Alternative text](image-url.jpg).

Quotations are indicated with a greater than sign before the text: > This is a quote..

Advanced Documentation with Markdown

In addition to the basic syntax, Markdown allows you to create tables, use task lists, blocks of code with syntax highlighting, and much more.

Tables are created using pipes and hyphens to separate cell and column headers. For example:

| Heading 1 | Heading 2 |
| ------------ | ------------ |
| Item 1 | Item 2 |
| Item 3 | Item 4 |

To-do lists add a level of interactivity to documents by allowing readers to mark items as completed. They are created with square brackets:

  • - [ ] Task not completed
  • - [x] Task completed

Syntax-highlighted code blocks are created with three backticks, followed by the name of the programming language. For example, a block of code in Python would be:

```python
def hello_world():
    print("Hello, world!")
```

Integrating Markdown with GitHub

GitHub fully supports Markdown in several places, including comments on issues and pull requests, .md files, and wikis. This allows developers to integrate documentation directly with the repository, facilitating collaboration and information sharing.

Additionally, GitHub Pages allows users to create static websites for their personal or documentation projects using Markdown. With the integration of Jekyll, a static blogging platform, you can transform Markdown documents into elegant and functional websites.

Best Practices for Markdown Documentation

To ensure that documentation is effective and useful, it is important to follow some good practices:

  • Keep the text clear and concise.
  • Use lists and subheadings to organize content.
  • Include examples and screenshots where appropriate.
  • Review documentation regularly to keep information up to date.
  • Encourage contributionsfrom other users, providing clear guidelines for contributions.

Effective use of Markdown on GitHub can significantly improve the quality of a project's documentation, making it more accessible and easier to understand. This not only benefits current users, but can also help attract new contributors and users to the project.

Conclusion

Markdown is a powerful tool for creating documentation on GitHub. Its use facilitates collaboration and information sharing between developers, as well as helping to keep project documentation organized and updated. With the simplicity and flexibility of Markdown, anyone can create rich, well-formatted documents with ease.

Now answer the exercise about the content:

Which of the following statements about using Markdown on GitHub is true?

You are right! Congratulations, now go to the next page

You missed! Try again.

Article image Project Management with Kanban on GitHub

Next page of the Free Ebook:

41Project Management with Kanban on GitHub

4 minutes

Obtenez votre certificat pour ce cours gratuitement ! en téléchargeant lapplication Cursa et en lisant lebook qui sy trouve. Disponible sur Google Play ou App Store !

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text