Go back

How to use Markdown (.md) files

What is Markdown?

Markdown is a lightweight markup language used to format plain text. It's widely used for writing documentation, README files, blog posts, and even in tools like GitHub for project descriptions. Markdown files are saved with the .md extension, such as README.md.

Basic Syntax

1. Headings

Headings in Markdown are created by adding # symbols before your text. The number of # symbols determines the heading level.

# This is a top-level heading (h1)

## This is a second-level heading (h2)

### This is a third-level heading (h3)

2. Paragraphs

Paragraphs are simply blocks of text separated by one or more blank lines.

This is a paragraph.

This is another paragraph.

3. Emphasis

You can make text italic or bold using either asterisks * or underscores _.

  • Italic or Italic:
    _italic text_ or _italic text_
    
  • Bold or Bold:
    **bold text** or **bold text**
    
  • Bold and Italic:
    **_bold and italic text_**
    

4. Lists

  • Unordered List (bullet points): Use -, *, or + followed by a space.
- Item 1
- Item 2
  - Sub-item 1
  - Sub-item 2
  • Ordered List (numbered list): Use numbers followed by a period.
1. First item
2. Second item
   1. Sub-item
   2. Sub-item

You can create links with the following syntax:

[Link Text](http://example.com)

For example:

[Google](https://www.google.com)

6. Images

Images are similar to links but with an exclamation mark ! in front.

![Alt text](image_url.jpg)

Example:

![A cat](https://example.com/cat.jpg)

7. Code

  • Inline Code: Use backticks (`\) for inline code.
Here is some `inline code`.
  • Code Blocks: Use triple backticks (```) for code blocks.

This is a code block. It can span multiple lines.

You can also specify the programming language for syntax highlighting:

```javascript
console.log("Hello, world!");
```

8. Blockquotes

Blockquotes are created by using a > symbol.

> This is a blockquote.

9. Horizontal Lines

You can create horizontal lines by using three hyphens (---), asterisks (***), or underscores (___).

---

10. Tables

Tables are created using pipes | and hyphens -. The headers are separated by hyphens, and each column is divided by a pipe.

| Header 1 | Header 2 |
| -------- | -------- |
| Cell 1   | Cell 2   |
| Cell 3   | Cell 4   |

The result will look like:

Header 1Header 2
Cell 1Cell 2
Cell 3Cell 4

Advanced Features

1. Task Lists (Checklists)

You can create a to-do list with checkboxes.

- [x] Task 1 (Completed)
- [ ] Task 2 (Pending)

2. Footnotes

You can add footnotes using [^1].

This is a sentence with a footnote.[^1]

[^1]: This is the footnote text.

3. Collapsible Sections

You can create collapsible sections (like an FAQ section) using HTML within Markdown.

<details>
  <summary>Click to reveal answer</summary>
  This is the hidden content.
</details>

Fishka and Markdown

If by "fishka" you meant a "trick" or "hidden gem" in Markdown, then here are some cool tips:

  • Use Emojis: You can add emojis by typing their names between colons.
    Example:
    :smile: :rocket: :heart:
    
  • Task List with Links: Add links inside checkboxes to create clickable to-do lists with external links.
    - [x] [Check the project](https://github.com) for the updates.
    
  • Embed External Content: Markdown can embed external content using HTML, such as embedding a YouTube video, GitHub repo, or a tweet.
    Example (embed a YouTube video):
    <iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
    

Where to Use Markdown?

  • GitHub: Markdown is the main language for writing README files and documentation in repositories.
  • Blogging Platforms: Many static site generators, like Jekyll or Hugo, use Markdown to write posts.
  • Documentation: It's ideal for creating project documentation, especially in development.

Let me know if you'd like to go into any specific Markdown tricks or have a practical example for your project!

Share this post on: