Markdown

From HandWiki
Short description: Plain text markup language
Markdown
Markdown-mark.svg
Internet media typetext/markdown[1]
Uniform Type Identifier (UTI)net.daringfireball.markdown
Developed by
  • John Gruber
  • Aaron Swartz[2][3]
Latest release
1.0.1
(December 17, 2004 (19 years ago) (2004-12-17)[4])
Type of formatOpen file format[5]
Extended topandoc, MultiMarkdown, Markdown Extra, CommonMark,[6] RMarkdown[7]
Websitedaringfireball.net/projects/markdown/

Markdown[8] is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz[2][3] created Markdown in 2004 as a markup language that is intended to be easy to read in its source code form.[8] Markdown is widely used for blogging and instant messaging, and also used elsewhere in online forums, collaborative software, documentation pages, and readme files.

The initial description of Markdown[9] contained ambiguities and raised unanswered questions, causing implementations to both intentionally and accidentally diverge from the original version. This was addressed in 2014 when long-standing Markdown contributors released CommonMark, an unambiguous specification and test suite for Markdown.[10]

History

Markdown was inspired by pre-existing conventions for marking up plain text in email and usenet posts, such as the earlier markup languages setext (c. 1992), Textile (c. 2002), and reStructuredText (c. 2002).[8]

In 2002 Aaron Swartz created atx and referred to it as "the true structured text format". Gruber and Swartz[2][3] created the Markdown language in 2004, with the goal of enabling people "to write using an easy-to-read and easy-to-write plain text format, optionally convert it to structurally valid XHTML (or HTML)."[4]

Its key design goal was readability, that the language be readable as-is, without looking like it has been marked up with tags or formatting instructions,[11] unlike text formatted with 'heavier' markup languages, such as Rich Text Format (RTF), HTML, or even wikitext (each of which have obvious in-line tags and formatting instructions which can make the text more difficult for humans to read).

Gruber wrote a Perl script, Markdown.pl, which converts marked-up text input to valid, well-formed XHTML or HTML and replaces angle brackets (<, >) and ampersands (&) with their corresponding character entity references. It can take the role of a standalone script, a plugin for Blosxom or a Movable Type, or of a text filter for BBEdit.[4]

Rise and divergence

As Markdown's popularity grew rapidly, many Markdown implementations appeared, driven mostly by the need for additional features such as tables, footnotes, definition lists,[note 1] and Markdown inside HTML blocks.

The behavior of some of these diverged from the reference implementation, as Markdown was only characterised by an informal specification[12] and a Perl implementation for conversion to HTML.

At the same time, a number of ambiguities in the informal specification had attracted attention.[13] These issues spurred the creation of tools such as Babelmark[14][15] to compare the output of various implementations,[16] and an effort by some developers of Markdown parsers for standardisation. However, Gruber has argued that complete standardization would be a mistake: "Different sites (and people) have different needs. No one syntax would make all happy."[17]

Gruber avoided using curly braces in Markdown to unofficially reserve them for implementation-specific extensions.[18]

Standardization

CommonMark
Markdown-mark.svg
Filename extensions.md, .markdown[1]
Internet media typetext/markdown; variant=CommonMark[6]
Uniform Type Identifier (UTI)uncertain[19]
UTI conformationpublic.plain-text
Developed byJohn MacFarlane, open source
Initial releaseOctober 25, 2014 (9 years ago) (2014-10-25)
Latest release
0.30
(June 19, 2021 (2 years ago) (2021-06-19)[20])
Type of formatOpen file format
Extended fromMarkdown
Extended toGitHub Flavored Markdown
Websitecommonmark.org spec.commonmark.org

From 2012, a group of people, including Jeff Atwood and John MacFarlane, launched what Atwood characterised as a standardisation effort.[10] A community website now aims to "document various tools and resources available to document authors and developers, as well as implementors of the various Markdown implementations".[21] In September 2014, Gruber objected to the usage of "Markdown" in the name of this effort and it was rebranded as CommonMark.[22][23] CommonMark.org published several versions of a specification, reference implementation, test suite, and "[plans] to announce a finalized 1.0 spec and test suite in 2019."[24] No 1.0 spec has since been released as major issues still remain unsolved.[25] Nonetheless, the following websites and projects have adopted CommonMark: Discourse, GitHub, GitLab, Reddit, Qt, Stack Exchange (Stack Overflow), and Swift.

In March 2016 two relevant informational Internet RFCs were published:

  • RFC 7763 introduced MIME type text/markdown.
  • RFC 7764 discussed and registered the variants MultiMarkdown, GitHub Flavored Markdown (GFM), Pandoc, and Markdown Extra among others.[26]

Variants

Websites like Bitbucket, Diaspora, GitHub,[27] OpenStreetMap, Reddit,[28] SourceForge,[29] and Stack Exchange[30] use variants of Markdown to make discussions between users easier.

Depending on implementation, basic inline HTML tags may be supported.[31] Italic text may be implemented by _underscores_ or *single-asterisks*.[32]

GitHub Flavored Markdown

GitHub had been using its own variant of Markdown since as early as 2009,[33] which added support for additional formatting such as tables and nesting block content inside list elements, as well as GitHub-specific features such as auto-linking references to commits, issues, usernames, etc. In 2017, GitHub released a formal specification of its GitHub Flavored Markdown (GFM) that is based on CommonMark.[27] It is a strict superset of CommonMark, following its specification exactly except for tables, strikethrough, autolinks and task lists, which GFM adds as extensions.[34] Accordingly, GitHub also changed the parser used on their sites, which required that some documents be changed. For instance, GFM now requires that the hash symbol that creates a heading be separated from the heading text by a space character.

Markdown Extra

Markdown Extra is a lightweight markup language based on Markdown implemented in PHP (originally), Python and Ruby.[35] It adds the following features that are not available with regular Markdown:

  • Markdown markup inside HTML blocks
  • Elements with id/class attribute
  • "Fenced code blocks" that span multiple lines of code
  • Tables[36]
  • Definition lists
  • Footnotes
  • Abbreviations

Markdown Extra is supported in some content management systems such as Drupal,[37] Grav (CMS) and TYPO3.[38]

LiaScript

LiaScript[39] is a Markdown dialect that was designed to create interactive educational content. It is implemented in Elm and TypeScript and adds additional syntax elements to define features like:

  • Animations
  • Automatic speech output
  • Mathematical formulas (using KaTeX)
  • ASCII art diagrams
  • Various types of quizzes and surveys
  • JavaScript is natively supported and can be attached to various elements, this way code fragments can be made executable and editable

Examples

Text using Markdown syntax Corresponding HTML produced by a Markdown processor Text viewed in a browser
Heading
=======

Sub-heading
-----------

# Alternative heading

## Alternative sub-heading

Paragraphs are separated 
by a blank line.

Two spaces at the end of a line  
produce a line break.
<h1>Heading</h1>

<h2>Sub-heading</h2>

<h1>Alternative heading</h1>

<h2>Alternative sub-heading</h2>

<p>Paragraphs are separated
by a blank line.</p>

<p>Two spaces at the end of a line<br />
produce a line break.</p>
Heading
Sub-heading
Alternative heading
Alternative sub-heading

Paragraphs are separated by a blank line.

Two spaces at the end of a line
produce a line break.

Text attributes _italic_, **bold**, `monospace`.

Horizontal rule:

---
<p>Text attributes <em>italic</em>, <strong>bold</strong>, <code>monospace</code>.</p>

<p>Horizontal rule:</p>

<hr />
Text attributes italic, bold, monospace.

Horizontal rule:


Bullet lists nested within numbered list:

  1. fruits
     * apple
     * banana
  2. vegetables
     - carrot
     - broccoli
<p>Bullet lists nested within numbered list:</p>

<ol>
  <li>fruits <ul>
      <li>apple</li>
      <li>banana</li>
  </ul></li>
  <li>vegetables <ul>
      <li>carrot</li>
      <li>broccoli</li>
  </ul></li>
</ol>
Bullet lists nested within numbered list:
  1. fruits
    • apple
    • banana
  2. vegetables
    • carrot
    • broccoli
A [link](http://example.com).

![Image](Icon-pictures.png "icon")

> Markdown uses email-style
characters for blockquoting.
>
> Multiple paragraphs need to be prepended individually.

Most inline <abbr title="Hypertext Markup Language">HTML</abbr> tags are supported.
<p>A <a href="http://example.com">link</a>.</p>

<p><img alt="Image" title="icon" src="Icon-pictures.png" /></p>

<blockquote>
<p>Markdown uses email-style characters for blockquoting.</p>
<p>Multiple paragraphs need to be prepended individually.</p>
</blockquote>

<p>Most inline <abbr title="Hypertext Markup Language">HTML</abbr> tags are supported.</p>
A link.

Image

Markdown uses email-style characters for blockquoting.

Multiple paragraphs need to be prepended individually.

Most inline HTML tags are supported.

Implementations

Implementations of Markdown are available for over a dozen programming languages; in addition, many applications, platforms and frameworks support Markdown.[40] For example, Markdown plugins exist for every major blogging platform.[41]

While Markdown is a minimal markup language and is read and edited with a normal text editor, there are specially designed editors that preview the files with styles, which are available for all major platforms. Many general-purpose text and code editors have syntax highlighting plugins for Markdown built into them or available as optional download. Editors may feature a side-by-side preview window or render the code directly in a WYSIWYG fashion.

Some apps, services and editors support Markdown as an editing format, including:

  • ChatGPT: Output from the AI model formatted in Markdown will be rendered in LaTeX and HTML by the ChatGPT client, and the model is encouraged to use Markdown to format its output. Markdown provided by the user will not be formatted by the client, but will still be passed to the AI model unaltered.
  • Microsoft Teams: chat messages[42]
  • Discord: chat messages[43]
  • JotterPad: an online WYSIWYG editor that supports Markdown and fountain[44]
  • Doxygen: a source code documentation generator which supports Markdown with extra features[45]
  • RStudio: an IDE for R. It provides a C++ wrapper function for a markdown variant called sundown[46]
  • GitHub Flavored Markdown (GFM) ignores underscores in words, and adds syntax highlighting, task lists,[47] and tables[27]
  • RMarkdown[48]
  • Nextcloud Notes: the default app for taking notes on the Nextcloud platform supports formatting using Markdown[49]
  • Joplin: a note-taking application that supports markdown formatting[50]
  • Simplenote[51]
  • Obsidian is note-taking software based on Markdown files.[52]
  • The GNOME Evolution email client supports composing messages in Markdown format,[53] with the ability to send and render emails in pure Markdown format (Content-Type: text/markdown;) or to convert Markdown to plaintext or HTML email when sending.
  • The Mozilla Thunderbird email client supports Markdown through the "Markdown here Revival" add-on.
  • Kanboard uses the standard Markdown syntax as its only formatting syntax for task descriptions.[54]
  • Discourse uses the CommonMark flavor of Markdown in the forum post composer.
  • Bugzilla uses a customized version of Markdown.[55]

See also

Explanatory notes

  1. Technically HTML description lists

References

  1. 1.0 1.1 Leonard, Sean (March 2016). "The text/markdown Media Type". Request for Comments: 7763 (Internet Engineering Task Force). https://datatracker.ietf.org/doc/html/rfc7763. Retrieved 27 March 2022. "This document registers the text/markdown media type for use with Markdown, a family of plain-text formatting syntaxes that optionally can be converted to formal markup languages such as HTML.". 
  2. 2.0 2.1 2.2 Hendler, James (10 November 2022). "Foreword by James Hendler" (in en). Aaron Swartz's A Programmable Web: An Unfinished Work. Synthesis Lectures on Data, Semantics, and Knowledge. Springer Nature Switzerland. pp. ix. doi:10.1007/978-3-031-79444-5. ISBN 978-3-031-79444-5. https://en.wikisource.org/w/index.php?title=File:Aaron_Swartz_s_A_Programmable_Web_An_Unfinished_Work.pdf&page=11. Retrieved 12 January 2024. "This document was originally produced in "markdown" format, a simplified HTML/Wiki format that Aaron co-designed with John Gruber ca. 2004." 
  3. 3.0 3.1 3.2 Krewinkel, Albert; Winkler, Robert (8 May 2017). "Formatting Open Science: agilely creating multiple document formats for academic manuscripts with Pandoc Scholar" (in en). PeerJ Computer Science 3: 6. doi:10.7717/peerj-cs.112. https://peerj.com/articles/cs-112/. Retrieved 12 January 2024. "Markdown was originally developed by John Gruber in collaboration with Aaron Swartz, with the goal to simplify the writing of HTML documents". 
  4. 4.0 4.1 4.2 Markdown 1.0.1 readme source code "Daring Fireball – Markdown". 2004-12-17. http://daringfireball.net/projects/markdown/. 
  5. "Markdown: License". Daring Fireball. http://daringfireball.net/projects/markdown/license. 
  6. 6.0 6.1 Leonard, Sean (March 2016). "Guidance on Markdown: Design Philosophies, Stability Strategies, and Select Registrations". Request for Comments: 7764 (Internet Engineering Task Force). https://datatracker.ietf.org/doc/html/rfc7764. Retrieved 27 March 2022. "This document elaborates upon the text/markdown media type for use with Markdown, a family of plain-text formatting syntaxes that optionally can be converted to formal markup languages such as HTML. Background information, local storage strategies, and additional syntax registrations are supplied.". 
  7. "RMarkdown Reference site". https://rmarkdown.rstudio.com/. 
  8. 8.0 8.1 8.2 Cite error: Invalid <ref> tag; no text was provided for refs named philosophy
  9. "Daring Fireball: Introducing Markdown". https://daringfireball.net/2004/03/introducing_markdown. 
  10. 10.0 10.1 Atwood, Jeff (2012-10-25). "The Future of Markdown". CodingHorror.com. http://www.codinghorror.com/blog/2012/10/the-future-of-markdown.html. 
  11. Cite error: Invalid <ref> tag; no text was provided for refs named {{{1}}}
  12. "Markdown Syntax Documentation". Daring Fireball. https://daringfireball.net/projects/markdown/syntax. 
  13. "GitHub Flavored Markdown Spec – Why is a spec needed?". https://github.github.com/gfm/#why-is-a-spec-needed-. 
  14. "Babelmark 2 – Compare markdown implementations". Johnmacfarlane.net. http://johnmacfarlane.net/babelmark2/. 
  15. "Babelmark 3 – Compare Markdown Implementations". github.io. https://babelmark.github.io/. 
  16. "Babelmark 2 – FAQ". Johnmacfarlane.net. http://johnmacfarlane.net/babelmark2/faq.html. 
  17. Gruber, John [@gruber] (4 September 2014). "@tobie @espadrine @comex @wycats Because different sites (and people) have different needs. No one syntax would make all happy.". https://twitter.com/gruber/status/507670720886091776. 
  18. Gruber, John (19 May 2022). "Markdoc". https://daringfireball.net/linked/2022/05/19/markdoc. "I love their syntax extensions — very true to the spirit of Markdown. They use curly braces for their extensions; I'm not sure I ever made this clear, publicly, but I avoided using curly braces in Markdown itself — even though they are very tempting characters — to unofficially reserve them for implementation-specific extensions. Markdoc's extensive use of curly braces for its syntax is exactly the sort of thing I was thinking about." 
  19. "UTI of a CommonMark document". 12 April 2017. https://talk.commonmark.org/t/uti-of-a-commonmark-document/2406. 
  20. "CommonMark specification". http://spec.commonmark.org/. 
  21. "Markdown Community Page". GitHub. https://markdown.github.io/. 
  22. "Standard Markdown is now Common Markdown". Jeff Atwood. 4 September 2014. http://blog.codinghorror.com/standard-markdown-is-now-common-markdown/. 
  23. "Standard Markdown Becomes Common Markdown then CommonMark". InfoQ. http://www.infoq.com/news/2014/09/markdown-commonmark. 
  24. "CommonMark" (in en). http://commonmark.org/. "" The current version of the CommonMark spec is complete, and quite robust after a year of public feedback … but not quite final. With your help, we plan to announce a finalized 1.0 spec and test suite in 2019."" 
  25. "Issues we MUST resolve before 1.0 release [6 remaining"] (in en-US). 2015-07-26. https://talk.commonmark.org/t/issues-we-must-resolve-before-1-0-release-6-remaining/1287. 
  26. "Markdown Variants". IANA. 2016-03-28. https://www.iana.org/assignments/markdown-variants/markdown-variants.xhtml. 
  27. 27.0 27.1 27.2 "GitHub Flavored Markdown Spec". GitHub. https://github.github.com/gfm/. 
  28. "Reddit markdown primer. Or, how do you do all that fancy formatting in your comments, anyway?". Reddit. https://www.reddit.com/r/reddit.com/comments/6ewgt/reddit_markdown_primer_or_how_do_you_do_all_that/. 
  29. "SourceForge: Markdown Syntax Guide". SourceForge. http://sourceforge.net/p/forge/documentation/markdown_syntax/. 
  30. "Markdown Editing Help". StackOverflow.com. https://stackoverflow.com/editing-help. 
  31. "Markdown Syntax Documentation". https://daringfireball.net/projects/markdown/syntax#html. 
  32. "Basic Syntax: Italic". The Markdown Guide. Matt Cone. https://www.markdownguide.org/basic-syntax/#italic. Retrieved 27 March 2022. "To italicize text, add one asterisk or underscore before and after a word or phrase. To italicize the middle of a word for emphasis, add one asterisk without spaces around the letters." 
  33. Tom Preston-Werner. "GitHub Flavored Markdown Examples". https://github.com/mojombo/github-flavored-markdown/issues/1. Retrieved 2021-04-02. 
  34. "A formal spec for GitHub Flavored Markdown". 14 March 2017. https://githubengineering.com/a-formal-spec-for-github-markdown/. 
  35. Fortin, Michel (2018). "PHP Markdown Extra". Michel Fortin website. https://michelf.ca/projects/php-markdown/extra. 
  36. "PHP Markdown Extra". https://michelf.ca/projects/php-markdown/extra. 
  37. "Markdown editor for BUEditor". 4 December 2008. https://drupal.org/project/markdowneditor. 
  38. "Markdown for TYPO3 (markdown_content)". https://extensions.typo3.org/extension/markdown_content/. 
  39. Dietrich, André. "LiaScript" (in en). https://liascript.github.io/. 
  40. "W3C Community Page of Markdown Implementations". https://www.w3.org/community/markdown/wiki/MarkdownImplementations. 
  41. "Markdown THrowdown – What happens when FOSS software gets corporate backing". Ars Technica. 2014-10-05. https://arstechnica.com/information-technology/2014/10/markdown-throwdown-what-happens-when-foss-software-gets-corporate-backing/. 
  42. "Use Markdown formatting in Teams". https://support.microsoft.com/en-us/office/use-markdown-formatting-in-teams-4d10bd65-55e2-4b2d-a1f3-2bebdcd2c772. 
  43. "Markdown Text 101 (Chat Formatting: Bold, Italic, Underline)". https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-?page=4. 
  44. "Why You Need a WYSIWYG Editor When Writing in Markdown and Fountain" (in en). 2020-11-17. https://blog.jotterpad.app/why-need-wysiwyg-markdown-fountain-editor/. 
  45. "Doxygen Manual: Markdown support". http://doxygen.nl/manual/markdown.html. 
  46. Allaire, J.J.; e.a. (2015-06-30). "Markdown.cpp". GitHub project RStudio. https://github.com/rstudio/rstudio/blob/master/src/cpp/core/markdown/Markdown.cpp. 
  47. "Writing on GitHub". GitHub, Inc.. https://help.github.com/articles/writing-on-github. 
  48. R Markdown: The Definitive Guide. https://bookdown.org/yihui/rmarkdown/. Retrieved 2021-08-23. 
  49. "Nextcloud Notes * App" (in en). https://apps.nextcloud.com/apps/notes. 
  50. "Markdown Guide" (in en). https://joplinapp.org/markdown/index.html. 
  51. "Help" (in en). 2015-07-30. https://simplenote.com/help/. 
  52. "Obsidian" (in en). https://obsidian.md/. 
  53. @EvolutionGnome. "Evolution 3.44 is out and already available on #Flathub! Besides many smaller improvements and fixes it brings a markdown editor to compose messages. 👇". https://twitter.com/EvolutionGnome/status/1506712955743883283.  Missing or empty |date= (help)
  54. "Markdown Syntax — Kanboard documentation". https://docs.kanboard.org/en/latest/user_guide/markdown_syntax.html. 
  55. "330707 - Add optional support for MarkDown" (in en). https://bugzilla.mozilla.org/show_bug.cgi?id=330707. 

External links

  • for original John Gruber markup