Markdown was created back in 2004 by John Gruber from Daring Fireball as a lightweight markup language to publish content on the web. It consists of easy to understand plain text syntax to create HTML or XHTML by implementing a simple Perl script.
Since then, a lot of different versions or ‘flavours’ of markdown have appeared. While tables weren’t a part of the original language, most modern versions consist of syntax to make good-looking and easy formattable tables for web content.
In this article, we’re going over how you can create and format tables in markdown.
Also read: How to add contact form in WordPress?
Creating tables in Markdown
Creating tables in markdown is surprisingly easy. The syntax is pretty basic, and the formatting options are plenty.
The basic syntax for a markdown table consists of cells separated by pipes (|). You can create header columns by using hyphens (-).
| Header 1 | Header 2 | |----------|----------| | Data | Data | | Data | Data |
The pipes don’t need to be aligned exactly. The output remains the same regardless of alignment.
Internal text alignment
You can align text internally using colons (:) on the side you want to align the text.
| Syntax | Description | Test Text | | :--- | :----: | ---: | | Header | Title | Here's this | | Paragraph | Text | And more |
Text formatting in tables
While you can’t use HTML tags or headings, blockquotes, lists, horizontal rules and images, you can add links, code or emphasis using backticks (`).
You can use escape characters as well by preceding them with a backslash (\). Here’s an example.
Column 1 | Column 2 | Column 3 --- | --- | --- **Bold text** | _Italics_ | [Here's a link](http://candid.technology) Text | *__Bold italics__* | `Code or preformat`
Also read: What’s the difference between HTML, XHTML and HTML5?
Markdown table generators
If you find writing markdown by hand too difficult when making tables, there are numerous Markdown table generators on the internet to help make the task easier.
Here are two of the best markdown table generators that you can use.
Markdown Table Generator
The site comes with a simple, easy-to-use interface. All you need to do is fill out the cells in the table as you want the data to look and hit generate. The site will automatically generate the required markdown code for you, which you can copy and paste wherever you want it published.
You can visit Markdown Table Generator here
Use Google Sheets/Excel
An online tool created by software developer Dave Johnson lets you convert Google Sheet or Excel tables to markdown by copying the table from one of these apps and pasting it inside the tool, hosted on his own blog.
You can visit Dave's tool here
Also read: Python vs Java vs C/C++: Key differences and Pros-Cons