Wed. Nov 29th, 2023



Markdown is a powerful alternative to HTML for crafting written content that can be easily shared online, kept in a notes app, or exported to other formats. Here’s a cheat sheet to get you up to speed.



Basic Markdown Syntax

There are various implementations of Markdown, some of which expand upon the basic syntax with support for more features (like mathematical formats). Regardless of which you’re using, the most basic syntax remains the same.

The following is a list of simple, common Markdown commands. This basic syntax is commonly referred to as CommonMark.

Function

Syntax

Alternative syntax

Bold

 **Bold** 
 __Bold__ 

Italic

 *Italic* 
 _Italic_ 

Headings

  
 Heading 1
==========

Heading 2

Link

 [How-To Geek](http: 

Image

 ![Alt-Text](http: 

Unordered list

             - Item 1
            - Item 2
            - Item 3

Ordered list

             1. Item 1
            2. Item 2
            3. Item 3
 1) Item 1
2) Item 2
3) Item 3

Code

 `code` 
 

Code block

 ```
code
block
```
            

Blockquote

> blockquote

 

Line break (horizontal rule)

  
 *** 

or

  

Advanced Markdown Syntax

On top of the basic syntax listed above, your Markdown editor may also support some more advanced functions, such as:

Function

Syntax

Table

 | Column 1 | Column 2 |
|
| Item 1 | Item 2 |
| Item 3 | Item 4 |

Strikethrough

 ~~strikethrough~~ 

Task list (checkbox)

 - [ ] Unchecked item
- [X] Checked item

Footnote

 Example of a footnote[^1] within text.
[^1]: Description of footnote text

Heading ID

  

Highlight

 ==highlighted text== 

LaTeX equations

 $$ equation goes here $$ 

Emoji

 :emoji-name: 

Superscript

 E=MC^2^ 

Subscript

 O~2~ 

Definitions

 Term to define
: This is the definition of the term
: This is another definition

Another term
: Yet another definition

Links are created in markdown by placing the placeholder text in square brackets, followed immediately by the link you want to share in standard brackets immediately after it. Make sure there isn’t a gap between them when you create your link, like so:

[How-To Geek](http://www.howtogeek.com)

Inserting Images with Markdown

Images can be inserted using Markdown with square and standard brackets. The descriptive alt text you use should go in the square brackets, with a link to the image following it in standard brackets, like so:

![alt-text](http://www.howtogeek.com/image.png)

If you’re having trouble getting this to work, make sure that the image is in the location that you specify. If you’re dragging images into a Markdown editor, the link will point to the location of the image on your local drive rather than its location on a web server.

How to Create a Table in Markdown

Tables are one of the more confusing Markdown elements to master, but they work just fine as long as you make sure the lines and spaces are all in the right place. You can differentiate the header row of a table using dashes, of which you only need three.

 | Column 1 | Column 2 |
|
| Item 1 | Item 2 |

You can beautify your table in code view if you want (and add more spaces and dashes to improve its readability), but if all you care about is the end result then the example above works just fine.

Keep in mind that many Markdown editors will have their own tools for creating tables, quickly expanding the number of rows and columns, and automatic formatting for copying and pasting items in or out of the column. This can be easier to implement if your app of choice supports it.

How to Use Code Blocks in Markdown

To create a code block in Markdown you have two options. You can either encase the text in a grave accent `, colloquially known as a backward apostrophe or the key that appears beneath “Esc” on most keyboards.

`code`

For a block of code, use three grave accents ``` at the start of the block, then three more at the end of the block. This allows you to quote multiple lines of code.

 ```
code block
```

Create Line Breaks (Horizontal Rules) in Markdown

Line breaks are useful for signifying the end of one section and the start of another. CommonMark supports line breaks through the use of three dashes:

---

Some editors (like Ulysses) require four dashes to trigger a line break.

How to Strikethrough Text with Markdown

Strikethrough isn’t commonly supported in Markdown, and so its implementation can vary between editors. One common way of using strikethrough is to use two tilde symbols, like so:

~~strikethrough text~~

Some editors include a “Delete” markup, which works like so:

||delete this text||

Using Subscript and Superscript in Markdown

Some editors allow you to use subscript using tilde symbols on either side of the input you want to format, like so:

O~2~

Others use chevrons to elevate text, like so:

E=MC^2^

If your editor doesn’t do this and you’re happy to use HTML, both the <sub> and <sup> HTML tags can be used for subscript and superscript, respectively.

Highlight Text in Markdown

Another non-standard function but one that some editors support, you may be able to highlight works using two equals symbols on either side of a word, like so:

You can't always =highlight text== in Markdown

Some editors use their own method of highlighting. Ulysses can use the “Mark” syntax:

Some editors use other syntax to ::highlight text:: with Markdown

Create Task Lists in Markdown (with Checkboxes)

Task lists are useful for keeping track of reminders, and they work a lot like unordered lists do except with one additional step. In addition to the dash you need to use to define a list at the beginning of a line, you also need to add the checkbox in its checked or unchecked state, like so:

- [ ] This item is unchecked- [X] This item is checked

Your Choice of Editor Matters

Markdown is versatile and powerful, but the experience can be even better with the right kind of editor. Apps like Ulysses and iA Writer put a price on the Markdown experience, but they’re arguably worth it if you spend a lot of time writing for the web.

For note-taking, apps like Bear and Obsidian have excellent free plans with affordable upgrade paths if you need more. Of course, there are plenty of free editors like MacDown and MarkText or the web-based Editor.md.

You can even use Markdown in Google Docs by tweaking a single setting.



Source link

By John P.

Leave a Reply

Your email address will not be published. Required fields are marked *