Lightweight markup language


A lightweight markup language, also termed a simple or humane markup language, is a markup language with simple, unobtrusive syntax. It is designed to be easy to write using any generic text editor and easy to read in its raw form. Lightweight markup languages are used in applications where it may be necessary to read the raw document as well as the final rendered output.
For instance, a person downloading a software library might prefer to read the documentation in a text editor rather than a web browser. Another application for such languages is to provide for data entry in web-based publishing, such as weblogs and wikis, where the input interface is a simple text box. The server software then converts the input into a common document markup language like HTML.

History

Lightweight markup languages were originally used on text-only displays which could not display characters in italics or bold, so informal methods to convey this information had to be developed. This formatting choice was naturally carried forth to plain-text email communications. Console browsers may also resort to similar display conventions.
In 1986 international standard SGML provided facilities to define and parse lightweight markup languages using grammars and tag implication. The 1998 W3C XML is a profile of SGML that omits these facilities. However, no SGML document type definition for any of the languages listed below is known.

Types

Lightweight markup languages can be categorized by their tag types. Like HTML, some languages use named elements that share a common format for start and end tags, whereas proper lightweight markup languages are restricted to ASCII-only punctuation marks and other non-letter symbols for tags, but some also mix both styles or allow embedded HTML, possibly extended with custom elements.
Most languages distinguish between markup for lines or blocks and for shorter spans of texts, but some only support inline markup.
Some markup languages are tailored for a specific purpose, such as documenting computer code or being converted to a certain output format and nothing else, others are more general in application. This includes whether they are oriented on textual presentation or on data serialization.
Presentation oriented languages include AsciiDoc, atx, BBCode, Creole, Crossmark, Epytext, Haml, JsonML, MakeDoc, Markdown, Org-mode, POD, reST, RD, Setext, SiSU, SPIP, Xupl, Texy!, Textile, txt2tags, UDO and Wikitext.
Data serialization oriented languages include Curl, JSON, and YAML.

Comparison of language features

LanguageHTML export toolHTML import toolTablesLink titlesclass attributeid attributeRelease date
AsciiDocNovember 25, 2002
BBCode1998
CreoleJuly 4, 2007
GitHub Flavored Markdown?
MarkdownMarch 19, 2004
Markdown Extra?
MediaWiki2002
MultiMarkdown?
Org-mode2003
PmWikiJanuary, 2002
POD1994
reStructuredTextApril 2, 2002
Slack
TextileDecember 26, 2002
Texy2004
txt2tagsJuly 26, 2001
WhatsAppMarch 16, 2016

Markdown's own syntax does not support class attributes or id attributes; however, since Markdown supports the inclusion of native HTML code, these features can be implemented using direct HTML.
txt2tags' own syntax does not support class attributes or id attributes; however, since txt2tags supports inclusion of native HTML code in tagged areas, these features can be implemented using direct HTML when saving to an HTML target.

Comparison of implementation features

Comparison of lightweight markup language syntax

Although usually documented as yielding italic and bold text, most lightweight markup processors output semantic HTML elements em and strong instead. Monospaced text may either result in semantic code or presentational tt elements. Few languages make a distinction, e.g. Textile, or allow the user to configure the output easily, e.g. Texy.
LMLs sometimes differ for multi-word markup where some require the markup characters to replace the inter-word spaces.
Some languages require a single character as prefix and suffix, other need doubled or even tripled ones or support both with slightly different meaning, e.g. different levels of emphasis.
HTML output<strong>strongly emphasized</strong><em>emphasized text</em><code>code</code>semantic
HTML output<b>bold text</b><i>italic text</i><tt>monospace text</tt>presentational
AsciiDoc*bold text*'italic text'+monospace text+Can double operators to apply formatting where there is no word boundary.
AsciiDoc*bold text*_italic text_`monospace text`Can double operators to apply formatting where there is no word boundary.
ATX*bold text*_italic text_|monospace text|email style
Creole**bold text**//italic text//Triple curly braces are for nowiki which is optionally monospace.
Markdown**bold text***italic text*`monospace text`semantic HTML tags
Markdown__bold text___italic text_`monospace text`semantic HTML tags
MediaWikibold textitalic textmonospace textmostly resorts to inline HTML
Org-mode*bold text*/italic text/=code=
Org-mode*bold text*/italic text/~verbatim~
PmWikibold textitalic text@@monospace text@@
reST**bold text***italic text*``monospace text``
Setext**bold text**~italic text~
Textile*strong*_emphasis_@monospace text@semantic HTML tags
Textile**bold text**__italic text__@monospace text@presentational HTML tags
Texy!**bold text***italic text*`monospace text`semantic HTML tags by default, optional support for presentational tags
Texy!**bold text**//italic text//`monospace text`semantic HTML tags by default, optional support for presentational tags
txt2tags**bold text**//italic text//``monospace text``
PODBICIndented text is also shown as monospaced code.
BBCodebold textitalic textmonospace textFormatting works across line breaks.
Slack*bold text*_italic text_`monospace text````block of monospaced text```
WhatsApp*bold text*_italic text_```monospace text```

Microsoft Word and Outlook, and accordingly other word processors and mail clients that strive for a similar user experience, also support the basic convention of using asterisks for boldface and underscores for italic style. While Word removes the characters, Outlook retains them.
CodeAsciiDocATXCreoleMarkdownMediaWikiOrg-modePmWikireSTSetextSlackTextileTexy!txt2tagsWhatsApp
*bold*
**bold**
__bold__
bold

CodeAsciiDocATXCreoleMarkdownMediaWikiOrg-modePmWikireSTSetextSlackTextileTexy!txt2tagsWhatsApp
*italic*
**italic**
_italic_
__italic__
'italic'
italic
/italic/
//italic//
~italic~

CodeAsciiDocATXCreoleMarkdownMediaWikiOrg-modePmWikireSTSetextSlackTextileTexy!txt2tagsWhatsApp
_underline_
__underline__

CodeAsciiDocATXCreoleMarkdownMediaWikiOrg-modePmWikireSTSetextSlackTextileTexy!txt2tagsWhatsApp
~stricken~
~~stricken~~
+stricken+
--stricken--

CodeAsciiDocATXCreoleMarkdownMediaWikiOrg-modePmWikireSTSetextSlackTextileTexy!txt2tagsWhatsApp
@code@
@@code@@
`code`
``code``
```code```
=code=
~code~
+code+
++code++
|code|

Heading syntax

Headings are usually available in up to six levels, but the top one is often reserved to contain the same as the document title, which may be set externally. Some documentation may associate levels with divisional types, e.g. part, chapter, section, article or paragraph.
Most LMLs follow one of two styles for headings, either Setext-like underlines or atx-like line markers, or they support both.

Underlined headings

Level 1 Heading
Level 2 Heading
---------------
Level 3 Heading
~~~~~~~~~~~~~~~

The first style uses underlines, i.e. repeated characters in the line below the heading text.
Chars:=-~*#+^_:"'`.min
Markdown1
Setext
AsciiDoc2
Texy!3
reStructuredTextheading width

RST determines heading levels dynamically, which makes authoring more individual on the one hand, but complicates merges from external sources on the other hand.

Prefixed headings

# Level 1 Heading
  1. # Level 2 Heading ##
  2. ## Level 3 Heading ###
The second style is based on repeated markers at the start of the heading itself, where the number of repetitions indicates the heading level. Most languages also support the reduplication of the markers at the end of the line, but whereas some make them mandatory, others do not even expect their numbers to match.
Character:=#*!+SuffixLevelsIndentation
AsciiDoc1–6
ATXunlimited
Creole1–6
MediaWiki1–6
txt2tags1–6
Markdown1–6
Texy!6–1 or 1–6, dynamic
Org-mode1– +∞
PmWiki1–6

POD and Textile choose the HTML convention of numbered heading levels instead.
Org-mode supports indentation as a means of indicating the level.
BBCode does not support section headings at all.
LanguageFormat
POD
=head1 Level 1 Heading
=head2 Level 2 Heading
Textile,
Jira
h1. Level 1 Heading
h2. Level 2 Heading
h3. Level 3 Heading
h4. Level 4 Heading
h5. Level 5 Heading
h6. Level 6 Heading

Microsoft Word supports auto-formatting paragraphs as headings if they don not contain more than a handful of words, no period at the end and the user hits the enter key twice. For lower levels, the user may press the tabulator key the according number of times before entering the text, i.e. one through eight tabs for heading levels two through nine.

Link syntax

Hyperlinks can either be added inline, which may clutter the code because of long URLs, or with named alias or numbered id references to lines containing nothing but the address and related attributes and often may be located anywhere in the document.
Most languages allow the author to specify text Text to be displayed instead of the plain address http://example.com and some also provide methods to set a different link title Title which may contain more information about the destination.
LMLs that are tailored for special setups, e.g. wikis or code documentation, may automatically generate named anchors inside the document, link to related pages or provide a textual search for linked keywords.
Most languages employ square or angular brackets to surround links, but hardly any two languages are completely compatible. Many can automatically recognize and parse absolute URLs inside the text without further markup.
LanguagesBasic syntaxText syntaxTitle syntax
BBCode, Creole, MediaWiki, PmWikihttp://example.com
Textilehttp://example.com"Text":http://example.com"Text ":http://example.com
Texy!http://example.com"Text":http://example.com"Text.":http://example.com
AsciiDochttp://example.comhttp://example.com
Slackhttp://example.com
txt2tags
MediaWiki
Creole, MediaWiki, PmWikiNameText
Org-modeNameName]http://example.comText
Markdown
reStructuredText`Text `_
PODL
PODL

List syntax

HTML requires an explicit element for the list, specifying its type, and one for each list item, but most lightweight markup languages need only different line prefixes for the bullet points or enumerated items. Some languages rely on indentation for nested lists, others use repeated parent list markers.
Characters:*-+#._:nest
Markdown0–31–3indent
MediaWiki01+repeat
Org-mode0+indent

Microsoft Word automatically converts paragraphs that start with an asterisk *, hyphen-minus - or greater-than bracket > followed by a space or horizontal tabulator as bullet list items. It will also start an enumerated list for the digit 1 and the case-insensitive letters a or i , a greater-than sign > or a hyphen-minus - and a space or tab; in case of the round parenthesis an optional opening one and whether they support to keep explicit values in the output format. Some Markdown dialects, for instance, will respect a start value other than 1, but ignore any other explicit value.

!
!
!
!
!
!
!
! nest
! | Markdown
! | MediaWiki
! | Org-mode