Markdown

From Canonica AI

Introduction

Markdown is a lightweight and easy-to-use syntax for styling all forms of writing on the web. It is designed to be easy to write and read in its raw form yet still be converted to HTML or other formats. The goal of Markdown's design is readability – the idea is that a Markdown-formatted document should be publishable as-is, in plain text, without looking like it's been marked up with tags or formatting instructions HyperText Markup Language.

History

Markdown was created in 2004 by John Gruber in collaboration with Aaron Swartz. Its key design goal is readability – that the language be readable as-is, without looking like it's been marked up with tags or formatting instructions, unlike text areas of most other markup languages (e.g., HTML, LaTeX, and Rich Text Format).

A screenshot of a Markdown document and its corresponding output. The document includes headings, links, and list items.
A screenshot of a Markdown document and its corresponding output. The document includes headings, links, and list items.

Syntax

Markdown's syntax is intended for one purpose: to be used as a format for writing for the web. Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In many cases, adding HTML tags is more difficult using Markdown than it is using straight HTML.

Headers

Markdown supports two styles of headers, Setext and atx. Setext-style headers are "underlined" using equal signs (for first-level headers) and dashes (for second-level headers). For example:

``` This is an H1

=

This is an H2


```

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

```

  1. This is an H1
    1. This is an H2
            1. This is an H6

```

Emphasis

Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML `` tag; double *’s or _’s will be wrapped with an HTML `` tag. E.g., this input:

```

  • single asterisks*

_single underscores_

    • double asterisks**

__double underscores__ ```

Lists

Markdown supports ordered (numbered) and unordered (bulleted) lists. Unordered lists use asterisks, pluses, and hyphens — interchangably — as list markers. Ordered lists use numbers followed by periods.

```

  • Red
  • Green
  • Blue

```

Links

Markdown uses square brackets to indicate the text to be linked, and parentheses to indicate the URL. For example:

``` This is [an example](http://example.com/ "Title") inline link. ```

Images

Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference. For example:

``` ![Alt text](/path/to/img.jpg)

![Alt text](/path/to/img.jpg "Optional title") ```

Code Blocks

Markdown wraps a code block in both ` and ~ characters. For example:

``` `code`

Ai (talk) code Ai (talk) ```

Tables

Markdown also supports tables by using the pipe symbol | to denote different cells. The header is separated from the rest of the table by a line of dashes (-), and colons (:) can be used to align the columns. For example:

``` | Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 | ```

Extensions

While the original Markdown syntax does not support many features needed for documentation (like footnotes, tables of contents, and definition lists), many of these features have been added in extensions to the original Markdown concept. Some of these extensions are supported in different Markdown processors (such as MultiMarkdown, Markdown Extra, and GitHub Flavored Markdown).

Applications

Markdown is used in many places in the web. It's used for writing articles, forum posts, and in software for note taking. Some of the popular applications of Markdown include GitHub, Reddit, Stack Overflow, and the Jekyll blogging platform.

See Also

Categories