Lightweight markup language

From Wikipedia, the free encyclopedia
  (Redirected from Lightweight markup)
Jump to: navigation, search

A lightweight markup language (LML), also termed a simple or humane markup language, is a markup language with simple, unobtrusive syntax. It is designed to be easy to create using any generic text editor, as well as 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.


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 DTD for any of the languages listed below is known.


Lightweight markup languages can be categorized by their tag types. Like HTML (<b>bold</b>), some languages use named elements that share a common format for start and end tags (e.g. BBCode [b]bold[/b]), 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 (e.g. Textile bq. ) or allow embedded HTML (e.g. Markdown), possibly extended with custom elements (e.g. MediaWiki <ref>source</ref>).

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 (e.g. POD, RD) or being converted to a certain output format (usually HTML) and nothing else, others are more general in application. This includes whether they are oriented on textual presentation or on data serialization.[clarification needed]

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 (homoiconic, but also reads JSON; every object serializes), JSON, OGDL, and YAML.

Comparison of language features[edit]

Comparing language features
Language HTML export tool HTML import tool Tables Link titles class attribute id attribute Release date
AsciiDoc Yes Yes Yes Yes Yes Yes November 25, 2002[1]
BBCode No No Yes No No No 1998[2][better source needed]
Creole No No Yes No No No July 4, 2007[3]
GitHub Flavored Markdown Yes No Yes Yes No No  ?
Markdown Yes Yes Yes/No Yes Yes/No Yes/No March 19, 2004[4][5]
Markdown Extra Yes Yes Yes[6] Yes Yes Yes  ?
MediaWiki Yes Yes Yes Yes Yes Yes 2002[7]
MultiMarkdown Yes No Yes Yes No No  ?
Org-mode Yes Yes[8] Yes Yes Yes Yes November 19, 2016[9]
PmWiki No Yes Yes Yes Yes Yes  ?
POD Yes ? No Yes ? ?  ?
reStructuredText Yes Yes[8] Yes Yes Yes auto April 2, 2002[10]
Textile Yes No Yes Yes Yes Yes December 26, 2002[11]
Texy Yes Yes Yes Yes Yes Yes 2004[12]
txt2tags Yes Yes[13] Yes[14] Yes Yes/No Yes/No July 26, 2001[15]

Markdown's own syntax does not support tables, class attributes, or id attributes; however, since Markdown supports inclusion of native HTML code, these features can be implemented using direct HTML. (Note that some extensions may support these features.)

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.[16]

Comparison of implementation features[edit]

Comparing implementations, especially output formats
Language Implementations XHTML Con/LaTeX PDF DocBook ODF EPUB DOC(X) LMLs Other License
AsciiDoc Python, Ruby, JavaScript XHTML LaTeX PDF DocBook ODF EPUB No  — Man page etc. GNU GPL, MIT
BBCode Perl, PHP, C#, Python, Ruby (X)HTML No No No No No No Public Domain
Creole PHP, Python, Ruby, JavaScript[17] Depends on implementation CC_BY-SA 1.0
GitHub Flavored Markdown Haskell (Pandoc) HTML LaTeX, ConTeXt PDF DocBook ODF EPUB DOC AsciiDoc, reST OPML GPL
Java,[18] JavaScript,[19][20][21] PHP,[22][23] Python,[24] Ruby[25] HTML[19][20][21][23][24] No No No No No No Proprietary
Markdown Perl (originally), C,[26][27] Python,[28] JavaScript, Haskell,[8] Ruby,[29] C#, Java, PHP HTML LaTeX, ConTeXt PDF DocBook ODF EPUB RTF MediaWiki, reST Man page, S5 etc. BSD-style & GPL (both)
Markdown Extra PHP (originally), Python, Ruby XHTML No No No No No No BSD-style & GPL (both)
MediaWiki Perl, PHP, Haskell, Python XHTML No No No No No No GNU GPL
MultiMarkdown C, Perl (X)HTML LaTeX PDF No ODF No DOC, RTF OPML GPL, MIT
Org-mode Emacs Lisp, Ruby (parser only), Perl, OCaml XHTML LaTeX PDF DocBook ODF EPUB[30] DOCX[30] Markdown TXT, XOXO, iCalendar, Texinfo, man, contrib: groff, s5, deck.js, Confluence Wiki Markup, TaskJuggler, RSS, FreeMind GPL
PmWiki PHP XHTML 1.0 Transitional No No No No No No GNU GPL
POD Perl (X)HTML, XML LaTeX No DocBook No No RTF Man page, plain text Artistic License, Perl's license
reStructuredText Python,[31][32] Haskell, Java, HTML, XML LaTeX PDF DocBook ODF EPUB DOC man, S5, Devhelp, QT Help, CHM, JSON Public Domain
Textile PHP, JavaScript, Java, Perl, Python, Ruby, ASP, C#, Haskell XHTML No No No No No No Textile License
Texy! PHP, C# (X)HTML No No No No No No GNU GPL v2 License
txt2tags Python,[33] PHP[34] (X)HTML, SGML LaTeX PDF DocBook ODF EPUB DOC Creole, AsciiDoc, MediaWiki, MoinMoin, PmWiki, DokuWiki, Google Code Wiki roff, man, MagicPoint, Lout, PageMaker, ASCII Art, TXT GPL

Comparison of lightweight markup language syntax[edit]

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 (infix). 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.

Comparing text formatting syntax
Language Bold Italic Monospace Notes
AsciiDoc *bold text* 'italic text' +monospace text+ Can double operators to apply formatting where there is no word boundary (for example **b**old t**ex**t yields bold text).
_italic text_ `monospace text`
Creole **bold text** //italic text// {{{monospace text}}} Triple curly braces are for nowiki which is optionally monospace in Creole (the choice of the implementor).
Markdown[35] **bold text** *italic text* `monospace text` Markdown doesn't use bold and italic tags, but rather em (typically italic) and strong (typically bold) tags.
__bold text__ _italic text_ `monospace text`
MediaWiki '''bold text''' ''italic text'' <code>monospace text</code> MediaWiki mostly resorts to inline HTML
Org-mode *bold text* /italic text/ =code= _underlined_
~verbatim~ +strike-through+
PmWiki '''bold text''' ''italic text'' @@monospace text@@
reST **bold text** *italic text* ``monospace text``
Setext **bold text** ~italic text~ _underlined_text_
Textile[36] *strong* _emphasis_ @monospace text@ Semantic strong and em HTML tags
**bold text** __italic text__ Presentational b and i HTML tags
Texy! **bold text** *italic text* `monospace text` Texy uses semantic tags by default, but can be configured to use presentational tags.
//italic text//
txt2tags **bold text** //italic text// ``monospace text`` __underlined__ --strike-through--
POD B<bold text> I<italic text> C<monospace text> Indented text is also shown as monospaced code.
BBCode [b]bold text[/b] [i]italic text[/i] [code]monospace text[/code] Formatting works across line breaks.

Heading syntax[edit]

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[edit]

Level 1 Heading

Level 2 Heading

Level 3 Heading

The first style uses underlines, i.e. repeated characters (e.g. equals =, hyphen - or tilde ~, usually at least two or four times) in the line below the heading text.

Underlined heading levels
Chars: = - ~ * # + ^ _ : ` < > min
Markdown 1 2 No No No No No No No No No No No No ?
Setext 1 2 No No No No No No No No No No No No ?
AsciiDoc 1 2 3 No No No No No No No No No No No ?
Texy! Yes Yes No Yes Yes No No No No No No No No No ?
reStructuredText Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ?

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

Prefixed headings[edit]

# Level 1 Heading
## Level 2 Heading ##
### Level 3 Heading ###

The second style is based on repeated markers (e.g. hash #, equals = or asterisk *) at the start of the heading itself, where the number of repetitions indicates the (sometimes inverse) 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.

Line prefix (and suffix) headings
Character: = # * ! + Suffix Levels Indentation
AsciiDoc Yes No No No No Optional 1–6 No
Creole Yes No No No No Optional 1–6 No
MediaWiki Yes No No No No Yes 1–6 No
txt2tags Yes No No No Yes Yes 1–6 No
Markdown No Yes No No No Optional 1–6 No
Texy! No Yes No No No Optional 6–1 or 1–6, dynamic No
Org-mode No No Yes No No No 1– +∞ alternative[37][38]
PmWiki No No No Yes No Optional 1–6 No

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.

Other heading formats
Language Format
=head1 Level 1 Heading
=head2 Level 2 Heading
h1. Level 1 Heading
h2. Level 2 Heading
h3. Level 3 Heading
h4. Level 4 Heading
h5. Level 5 Heading
h6. Level 6 Heading

Link syntax[edit]

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 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 (for headings, functions etc.) inside the document, link to related pages (possibly in a different namespace) or provide a textual search for linked keywords.

Most languages employ (double) 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.

Inline hyperlink syntax
Languages Basic syntax Text syntax Title syntax
BBCode, Creole, MediaWiki, PmWiki
Textile "Text": "Text (Title)":
Texy! "Text .(Title)":
txt2tags [] [Text]
MediaWiki [ Text]
Creole, MediaWiki, PmWiki [[Name]] [[Name|Text]]
Org-mode [[Name][Text]]
Creole [[Namespace:Name]] [[Namespace:Name|Text]]
Org-mode [[Namespace:Name][Text]]
Creole, PmWiki [[]] [[|Text]]
BBCode [url][/url] [url=]Text[/url]
Markdown <> [Text]( [Text]( "Title")
reStructuredText `Text <>`_
POD L</Name>
Reference syntax
Languages Text syntax Title syntax
... Name_ ...
.. _Name:
... [Text][id] ...
... [Text][id] ...
[id]: "Title"
... "Text":alias ...
... "Text":alias ...
[alias (Title)]
... "Text":alias ...
... "Text":alias ...
[alias]: .(Title)

List syntax[edit]

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.

Unordered, bullet list items
Characters: * - + # . · _ : indent skip nest
Markdown Yes Yes Yes No No No No No No No No 0–3 1–3 indent
MediaWiki Yes No No No No No No No No No No 0 1+ repeat

Languages differ on whether they support optional or mandatory digits in numbered list items, which kinds of enumerators they understand (e.g. decimal digit 1, roman numerals i or I, alphabetic letters a or A) and whether they support to keep explicit values in the output format. Some Markdown dialects, for instance, will honor a start value other than 1, but ignore any other explicit value.

Ordered, enumerated list items
Chars: #1 1. 1) 1] 1} (1) [1] {1} indent skip nest
Markdown No 1 1 No No No No No 0–3 1–3 indent
MediaWiki # No No No No No No No 0 1+ repeat

See also[edit]


  1. ^ "AsciiDoc ChangeLog". Retrieved 2017-02-24. 
  2. ^ "Wikipedia BBCode". Retrieved 2017-02-24. 
  3. ^ "WikiCreole Versions". Retrieved 2017-02-24. 
  4. ^ "Markdown". Aaron Swartz: The Weblog. 2004-03-19. 
  5. ^ "Daring Fireball: Markdown". Archived from the original on 2004-04-02. Retrieved 2014-04-25. 
  6. ^ "PHP Markdown Extra". Retrieved 2013-10-08. 
  7. ^ "MediaWiki history". Retrieved 2017-02-24. 
  8. ^ a b c Pandoc, which is written in Haskell, parses Markdown (in two forms) and ReStructuredText, as well as HTML and LaTeX; it writes from any of these formats to HTML, RTF, LaTeX, ConTeXt, OpenDocument, EPUB and several other formats, including (via LaTeX) PDF.
  9. ^ "Org mode for Emacs – Your Life in Plain Text". OrgMode team. Retrieved 2016-12-09. 
  10. ^ "An Introduction to reStructuredText". Retrieved 2017-02-24. 
  11. ^ "Textism › Tools › Textile". Archived from the original on 26 December 2002. 
  12. ^ "What is Texy". Retrieved 2017-02-24. 
  13. ^ "Html2wiki txt2tags module". Retrieved 2014-01-30. 
  14. ^ "Txt2tags User Guide". Retrieved 2017-02-24. 
  15. ^ "txt2tags changelog". Retrieved 2017-02-24. 
  16. ^ "Txt2tags User Guide". Retrieved 2017-02-24. 
  17. ^ "Converters". WikiCreole. Retrieved 2013-10-08. 
  18. ^ pegdown : A Java library for Markdown processing
  19. ^ a b gfms : Github Flavored Markdown Server
  20. ^ a b marked : A full-featured markdown parser and compiler, written in JavaScript. Built for speed.
  21. ^ a b node-gfm : GitHub flavored markdown to html converter
  22. ^ Parsedown : Markdown parser written in PHP
  23. ^ a b Ciconia : Markdown parser written in PHP
  24. ^ a b Grip : GitHub Readme Instant Preview
  25. ^ github-markdown : Self-contained Markdown parser for GitHub
  26. ^ peg-markdown is an implementation of markdown in C.
  27. ^ Discount is also an implementation of markdown in C.
  28. ^ "Python-Markdown". Retrieved 2013-10-08. 
  29. ^ Bruce Williams <>, for Ruby Central <>. "kramdown: Project Info". RubyForge. Archived from the original on 2013-08-07. Retrieved 2013-10-08. 
  30. ^ a b "Via ox-pandoc and pandoc itself". 
  31. ^ Docutils is an implementation of ReStructuredText in Python
  32. ^ Sphinx is an implementation of ReStructuredText in Python and Docutils with a number of output format Builders
  33. ^ Aurelio Jargas (2012-01-11). "txt2tags". txt2tags. Retrieved 2013-10-08. 
  34. ^ "txt2tags.class.php - online convertor [sic]". Retrieved 2013-10-08. 
  35. ^ "Markdown Syntax". Retrieved 2013-10-08. 
  36. ^ a b Textile Syntax Archived 2010-08-12 at the Wayback Machine.
  37. ^ "using org-adapt-indentation". 
  38. ^ "using org-indent-mode or org-indent". 

External links[edit]