This site is generated with Hugo. Hugo is a static website generator that uses Markdown to create content. The content that I write is written in Markdown.

Markdown

Markdown is a lightweight markup language that allows you to write formatted text using plain text syntax. It was created by John Gruber in 2004 with the goal of making it easy to write and read structured text that can be converted into HTML. Markdown is widely used for writing content on the web, especially for blogs and documentation.

Markdown provides a simple and intuitive way to create headings, lists, links, images, and other common elements without having to use HTML tags. An advantages of Markdown is that it separates the content from the formatting. This makes it easy to write and edit text without having to worry about the visual presentation.

One of the features of Markdown is the ability to create tables, which can be used to display data in a clear and organized way.

Creating a Basic Table

To create a table in Markdown, you’ll need to use the pipe character | to separate columns and hyphens - to separate the header row from the content rows. Here’s an example:

| Name  | Age | Gender |
|-------|-----|--------| 
| Alice | 27  | Female | 
| Bob   | 35  | Male   |

This will create a table with three columns (“Name”, “Age”, and “Gender”) and two rows of content. The hyphens in the second row separate the header row from the content rows. The result of the code is:

Name Age Gender
Alice 27 Female
Bob 35 Male

Formatting Table Content

You can add text formatting to the content of each cell using Markdown syntax. For example:

| Name    | Age | Gender |
|---------|-----|--------|
| **Alice** | 27  | *Female* |
| Bob     | 35  | Male   |

This will create a table with bold and italic formatting applied to the content of the first row. The result is:

Name Age Gender
Alice 27 Female
Bob 35 Male

Aligning Table Content

You can align the content in each column by using colons : in the header row. For example:

| Name    | Age | Gender |
|:--------|:---:|-------:|
| Alice   | 27  | Female |
| Bob     | 35  | Male   |

This will create a table with the “Name” column left-aligned, the “Age” column centered, and the “Gender” column right-aligned. The previous code results in:

Name Age Gender
Alice 27 Female
Bob 35 Male

To conclude

Creating tables in Markdown is very simple. By using the pipe character and hyphens to separate columns and rows, and adding formatting and alignment, you can create tables that are visually appealing.

References