Return
Markdown Editor Pro

Markdown Editor

Live Preview

Your formatted preview will appear here as you type...

Formatting

Actions

Statistics

Words: 0
Characters: 0
Lines: 0

The Birth of Markdown (2004)

Markdown was created in 2004 by John Gruber, a technology blogger and creator of the Daring Fireball blog. Gruber wanted a plain text formatting syntax that was easy to read and write, and that could be converted to valid HTML without requiring complex markup. The original Markdown specification was published on Daring Fireball on March 19, 2004, along with Markdown.pl, the reference Perl implementation Gruber wrote. [Daring Fireball, Markdown]

The name "Markdown" is a play on the term "markup," suggesting a simpler, reduced approach to formatting text. Aaron Swartz, a programmer and activist known for co-authoring the RSS 1.0 specification at age 14, helping build the technical architecture of Creative Commons, and later becoming a co-owner of Reddit, served as Gruber's primary beta tester. Swartz provided feedback on the syntax, helped refine the heading conventions using the hash symbol, and tested early implementations. [Wikipedia, Aaron Swartz] [Daring Fireball, Markdown]

The Philosophy of Readability

Gruber's core design principle was that a Markdown formatted document should be publishable as is, in plain text, without looking like it has been marked up with tags or formatting instructions. The syntax was inspired by existing conventions for formatting plain text emails, such as using asterisks for emphasis or hyphens for bullet points. Markdown was also influenced by earlier lightweight markup languages including setext (around 1992), Textile (2002), and reStructuredText (2002). [Daring Fireball, Markdown Syntax]

This philosophy of readability first distinguishes Markdown from heavier markup languages. A Markdown document should be comprehensible even before being rendered, making it ideal for readme files, documentation, comments on websites, and note taking applications.

Early Adoption and Growth (2000s)

Markdown gained rapid adoption within the developer community. Stack Overflow, launched in 2008, chose Markdown as its formatting language for questions and answers, exposing it to a large audience of developers for the first time and doing much to cement it as a standard for technical writing. WordPress added Markdown support through plugins, and Reddit implemented a Markdown variant for comments and posts. [Stack Overflow, Markdown Formatting Help]

GitHub adopted Markdown for README files, issue tracking, and comments, and over time developed its own GitHub Flavored Markdown (GFM) variant. GFM is a strict superset of the later CommonMark standard and adds tables using pipe characters, task lists with checkboxes, strikethrough using double tildes, and automatic URL linking. The GFM specification was formally published in 2017. [GitHub, About Writing and Formatting] [GitHub Flavored Markdown Spec]

The Parsing Process

Markdown operates through a parser that converts plain text with specific formatting patterns into valid HTML. The process involves scanning the input text, identifying patterns such as headings indicated by hash symbols, emphasis denoted by asterisks or underscores, and links using square brackets followed by parentheses. The parser then generates corresponding HTML tags including h1 through h6, strong, em, a, img, ul, ol, and others. [CommonMark Specification]

Most modern Markdown parsers operate in two phases. The first phase, sometimes called block parsing, identifies top level structures including paragraphs, headings, lists, blockquotes, code blocks, and horizontal rules. The second phase, inline parsing, processes the content inside blocks to handle bold text, italic text, links, images, code spans, and other inline formatting. This two phase approach ensures consistent handling of nested structures.

Parser Implementations

The original Markdown.pl was written in Perl, but today there are Markdown parsers available for virtually every programming language. Popular implementations include marked.js for JavaScript, Python Markdown for Python, redcarpet and kramdown for Ruby, commonmark.js for JavaScript, and flexmark for Java. Many of these parsers add extensions beyond the original syntax while maintaining backwards compatibility. [marked.js, Markdown Parser]

Performance considerations vary between parsers. Some prioritize speed for real time preview applications, while others focus on strict standards compliance or extensibility. Streaming parsers can process input incrementally, making them ideal for live editing where the user sees the rendered output update as they type.

The Security Consideration

Converting Markdown to HTML introduces potential security risks, particularly Cross Site Scripting (XSS) attacks. A malicious user could potentially inject JavaScript code into a Markdown document using image tags or link attributes. Responsible Markdown implementations sanitize the output HTML by escaping or removing dangerous content. Many parsers offer configuration options for sanitization, allowing developers to control which HTML tags and attributes are permitted in the rendered output. [OWASP, XSS Prevention]

Core Syntax Elements

Headings: Headings are created using hash symbols followed by a space. One hash for level one headings through six hashes for level six headings. Heading level one is typically the document title, while lower levels represent subsections. Headings automatically generate id attributes in many parsers for anchor linking.

Emphasis: Text can be italicized using single asterisks or underscores, made bold using double asterisks or double underscores, and struck through using double tildes. Combined emphasis like bold italic text is created using three asterisks. The asterisk syntax is generally preferred over underscores because it works correctly within words.

Lists: Unordered lists use asterisks, plus signs, or hyphens at the beginning of a line followed by a space. Ordered lists use numbers followed by periods. Lists can be nested by indenting child items with two to four spaces. List item content can contain multiple paragraphs and other block elements.

Links and Images: Inline links are created with square brackets containing the link text followed by parentheses containing the URL. Optionally, a title can be added in quotes after the URL. Reference links separate the URL from the link text using a reference label defined elsewhere in the document. Images use the same syntax but with an exclamation mark prefix.

Code: Inline code spans use backticks around the code. Code blocks are created by indenting each line by four spaces or one tab, or by using triple backticks before and after the block. Many parsers support syntax highlighting by specifying the programming language after the opening triple backticks.

Blockquotes: Blockquotes are created using a greater than symbol at the beginning of a line. Multiple lines can be quoted by adding the symbol to each line. Blockquotes can contain other Markdown elements including headings, lists, and code blocks. Nested blockquotes use multiple greater than symbols.

Horizontal Rules: Horizontal rule lines are created using three or more hyphens, asterisks, or underscores on a line by themselves. Spaces between the characters are allowed but not required. Horizontal rules create a thematic break in the content flow.

Major Dialects and Extensions

CommonMark: From 2012, a group of developers including Jeff Atwood (co-founder of Stack Overflow) and John MacFarlane (a philosophy professor at UC Berkeley and creator of the Pandoc document converter) worked toward a standardization effort for Markdown. In September 2014, after John Gruber objected to the use of "Markdown" in the project's original name, the effort was rebranded as CommonMark. The CommonMark specification provides an unambiguous standard for Markdown along with a comprehensive test suite, and has since been adopted by platforms including GitHub, GitLab, Reddit, and Stack Exchange. [CommonMark Official Site]

GitHub Flavored Markdown (GFM): GFM extends CommonMark with features popular on GitHub including task lists with checkboxes, tables using pipe characters and hyphens, strikethrough using double tildes, automatic URL linking, and emoji shortcodes. GFM also specifies how to handle user mentions with at symbols and issue references with hash symbols. [GitHub Flavored Markdown Spec]

MultiMarkdown: MultiMarkdown, developed by Fletcher Penney, adds significant extensions including tables, footnotes, citations, glossary entries, cross references, metadata blocks, and document metadata. It can also output formats other than HTML including LaTeX, OpenDocument, and OPML. [MultiMarkdown Documentation]

R Markdown: R Markdown integrates Markdown with R code chunks, allowing dynamic document generation with embedded computation results. It is widely used in data science and academic publishing, with the ability to produce HTML, PDF, Word, and slide presentations while executing code during the rendering process. [R Markdown Official Site]

Other Notable Flavors: PHP Markdown Extra adds tables, definition lists, footnotes, and abbreviation tags. kramdown, the default parser for Jekyll, supports many extensions including math syntax with MathJax integration. Pandoc Markdown, used by the powerful document converter Pandoc, supports the widest range of output formats and metadata features.