Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: doc/wiki/mediawiki/bnf/extracted
Source used for this grammar: MediaWiki, Markup spec/BNF/Article title, Revision 295042, 28 December 2009 [Page]
Source used for this grammar: MediaWiki, Markup spec/BNF/Article, Revision 281674, 17 October 2009 [Page]
Source used for this grammar: MediaWiki, Markup spec/BNF/Noparse-block, Revision 372814, 30 December 2010 [Page]
Source used for this grammar: MediaWiki, Markup spec/BNF/Links, Revision 376721, 18 January 2011 [Page]
Source used for this grammar: MediaWiki, Markup spec/BNF/Magic links, Revision 269783, 8 August 2009 [Page]
Source used for this grammar: MediaWiki, Markup spec/BNF/Special block, Revision 281676, 17 October 2009 [Page]
Source used for this grammar: MediaWiki, Markup spec/BNF/Inline text, Revision 295055, 29 December 2009 [Page]
Source used for this grammar: MediaWiki, Markup spec/BNF/Fundamental elements, Revision 212918, 17 September 2008 [Page]
BlockHTML
, WikiMarkupCharacters
, UnicodeCharacter
, UnicodeWiki
, PlainText
, WhiteSpaces
, NewLine
, Line
, Text
, PageName
, PageNameLink
, SectionTitle
, SectionLink
, LinkTitle
, TitleCharacter
, BadTitleCharacters
, SectionLinkCharacter
, BadSectionLinkCharacters
, noparse-block
, nowiki-block
, nowiki-opening-tag
, nowiki-closing-tag
, nowiki-body
, pre-block
, pre-opening-tag
, pre-closing-tag
, pre-body
, html-block
, html-opening-tag
, html-closing-tag
, html-body
, html-comment
, Table
, TableFirstRow
, TableRow
, TableColumn
, TableColumnLine
, TableColumnMultiLine
, TableParameters
, TableCellParameter
, ImageInline
, ImageName
, ImageExtension
, ImageOption
, ImageModeParameter
, ImageModeManualThumb
, ImageModeAutoThumb
, ImageModeFrame
, ImageModeFrameless
, ImageOtherParameter
, ImageParamPage
, ImageParamUpgright
, ImageParamBorder
, ImageSizeParameter
, ImageAlignParameter
, ImageAlignLeft
, ImageAlignCenter
, ImageAlignRight
, ImageAlignNone
, ImageValignParameter
, ImageValignBaseline
, ImageValignSub
, ImageValignSuper
, ImageValignTop
, ImageValignTextTop
, ImageValignMiddle
, ImageValignBottom
, ImageValignTextBottom
, Caption
, MediaInline
, MediaExtension
, GalleryBlock
, GalleryImage
, canonical-article-title
, canonical-sub-pages
, canonical-sub-page
, canonical-page
, canonical-page-chars
, canonical-page-first-char
, canonical-page-char
, sub-page-separator
, article-title
, sub-pages
, sub-page
, page
, page-chars
, page-first-char
, page-char
, wiki-page
, redirect
, redirect-tag
, article
, special-block-and-more
, paragraph-and-more
, paragraph
, lines-of-text
, line-of-text
, link
, internal-link
, article-link
, title-legal-chars
, interwiki-prefix
, interwiki
, namespace-prefix
, namespace
, link-description
, extra-description
, internal-link-start
, internal-link-end
, pipe
, section-id
, category
, category-namespace
, external-link
, url
, protocol
, url-path
, url-char
, external-link-start
, external-link-end
, magic-link
, isbn
, isbn-number
, rfc-number
, pmid-number
, special-block
, horizontal-rule
, dashes
, heading
, level-6-heading
, level-5-heading
, level-4-heading
, level-3-heading
, level-2-heading
, level-1-heading
, list-item
, indent-item
, enumerated-item
, bullet-item
, item-body
, defined-term
, definition
, space-block
, space-block-2
, inline-text
, inline-element
, text-with-formatting
, text
, html-entity
, html-entity-name
, html-unsafe-symbol
, unescaped-ampersand
, unescaped-less-than
, unescaped-greater-than
, harmless-characters
, random-character
, character
, whitespace
, newlines
, space-tabs
, whitespace-char
, space-tab
, spaces
, space
, newline
, BOL
, EOL
, non-whitespace-char
, letter
, ucase-letter
, lcase-letter
, symbol
, underscore
, decimal-number
, decimal-digit
, hex-number
, hex-digit
, formatting
, bold-italic-toggle
, bold-toggle
, italic-toggle
, apostrophe-jungle
, behaviour-switch
, behaviourswitch-toc
, behaviourswitch-forcetoc
, behaviourswitch-notoc
, behaviourswitch-noeditsection
, behaviourswitch-nogallery
), 0 root (—), 28 top (BlockHTML
, WikiMarkupCharacters
, WhiteSpaces
, Text
, PageNameLink
, SectionTitle
, SectionLink
, LinkTitle
, BadTitleCharacters
, BadSectionLinkCharacters
, noparse-block
, Table
, TableCellParameter
, ImageInline
, ImageModeAutoThumb
, ImageOtherParameter
, ImageParamUpgright
, ImageAlignCenter
, ImageValignParameter
, MediaInline
, GalleryBlock
, canonical-article-title
, wiki-page
, link
, category
, unescaped-less-than
, harmless-characters
, BOL
), 79 bottom (inline-html
, ?
4, ImageVAlignParameter
, __essentially___foo_
, ?_carriage_return_and_line_feed_?
, close-guillemet
, wgHtmlEntities
, EOF
4, noparseblock
, ?_carriage_return_?
, UnicodeCharacter_-
, LF
3, TableCellParameters
, LEGAL_URL_ENTITY
, BOF
, AnyText
, TableHTML
, SectionLinkCharacter_-
2, HeaderHTML
, ImageModeThumb
, NS_CATEGORY
, attributes
2, sensitive
, TAB
, more
, ?_tab_?
, Center
, unespaced-less-than
, gallery-block
, LEGAL_ARTICLE_ENTITY
, nowiki
, Div
, sort-key
, case
, ImageParamUpright
, Blockquote
, open-guillemet
, CR
3, Pipe
, table
2, FROM_LANGUAGE_FILE
, to_be_defined_
, digit
2, DIGIT
2, any
, HTML
2, image-inline
, ImageAlign
, characters
8, ?_line_feed_?
, UnicodeCharacter_-_BadSectionLinkCharacters
, i
5, category-link
, STRING_FROM_CONFIG
, harmless-character
, Sanitizer
, math-block
, ALLOWED_PROTOCOL_FROM_CONFIG
, g
, UnicodeCharacter_-_WikiMarkupCharacters
, InlineText
, non-word-character
, caption
, missing
, digits
2, STRING_FROM_DB
, PositiveInteger
, e
, ?_variants_of_spaces_?
, Pre
, CSS
3, PositiveNumber
, / nowiki
, b
, _jpg
, UnicodeCharacter_-_BadTitleCharacters
, cell
, media-inline
, ?_all_supported_Unicode_characters_?_-_Whitespaces
).BlockHTML ::= Pre Blockquote TableHTML Div HeaderHTML
WikiMarkupCharacters ::= "|" "[" "]" "*" "#" ":" ";" "<" ">" "=" "'" "{" "}"
UnicodeCharacter ::= ?_all_supported_Unicode_characters_?_-_Whitespaces
UnicodeWiki ::= UnicodeCharacter_-_WikiMarkupCharacters
PlainText ::= UnicodeWiki "<nowiki>" "|""[""]""<"">""{""}" "</nowiki>" UnicodeWiki " " "*""#"":"";" UnicodeWiki " " "=" " " UnicodeWiki UnicodeWiki "'" "'" UnicodeWiki
WhiteSpaces ::=
" "
NewLine
?_carriage_return_?
?_line_feed_?
?_tab_?
?_variants_of_spaces_?
NewLine ::= ?_carriage_return_and_line_feed_?
Line ::= PlainText PlainText" " " " PlainText PlainText
Text ::= Line LineNewLine NewLine Line Line
PageName ::= TitleCharacter "," " " TitleCharacter
PageNameLink ::= TitleCharacter "," " ""_" TitleCharacter
SectionTitle ::= "=" " " SectionLinkCharacter_- "="SectionLinkCharacter_-
SectionLink ::= SectionLinkCharacter "_" SectionLinkCharacter
LinkTitle ::= " " UnicodeCharacter_- "]"UnicodeCharacter
TitleCharacter ::= UnicodeCharacter_-_BadTitleCharacters
BadTitleCharacters ::= "[" "]" "{" "}" "<" ">" "_" "|" "#"
SectionLinkCharacter ::= UnicodeCharacter_-_BadSectionLinkCharacters
BadSectionLinkCharacters ::= "[" "]" "|"
noparse-block ::= nowiki-block html-block math-block pre-block html-comment
nowiki-block ::= nowiki-opening-tag whitespacenowiki-body whitespace nowiki-closing-tag ε
nowiki-opening-tag ::= "<nowiki" whitespace characters ">"
nowiki-closing-tag ::= "</nowiki" whitespace ">"
nowiki-body ::= characters
pre-block ::= pre-opening-tag whitespacepre-body whitespace pre-closing-tag ε
pre-opening-tag ::= "<pre" whitespace characters ">"
pre-closing-tag ::= "</pre" whitespace ">"
pre-body ::= characters
html-block ::= html-opening-tag whitespacehtml-body whitespace html-closing-tag ε
html-opening-tag ::= "<html" whitespace characters ">"
html-closing-tag ::= "</html" whitespace ">"
html-body ::= characters
html-comment ::= "<!--" characters "-->"
Table ::= "{|" " " TableParameters NewLine TableFirstRow "|}"
TableFirstRow ::= TableColumnLine NewLine TableColumnMultiLine TableRow
TableRow ::= "|-" CSS NewLine TableColumn TableRow
TableColumn ::= TableColumnLine TableColumnMultiLine
TableColumnLine ::= "|" InlineText "|" TableColumnLine
TableColumnMultiLine ::= "|" TableCellParameters "|" AnyText NewLine TableColumnMultiLine
TableParameters ::= CSS ? HTML table attributes ?
TableCellParameter ::= CSS ? HTML cell attributes ?
ImageInline ::= "[[" "Image:" PageName "." ImageExtension Pipe ImageOption "]]"
ImageName ::=
PageName "." ImageExtension
ImageExtension ::= "jpg" "jpeg" "png" "svg" "gif" "bmp"
ImageOption ::= ImageModeParameter ImageSizeParameter ImageAlignParameter ImageVAlignParameter Caption
ImageModeParameter ::= ImageModeManualThumb ImageModeThumb ImageModeFrame ImageModeFrameless
ImageModeManualThumb ::= "thumbnail=" ImageName "thumb=" ImageName
ImageModeAutoThumb ::= "thumbnail" "thumb"
ImageModeFrame ::= "framed" "enframed" "frame"
ImageModeFrameless ::=
"frameless"
ImageOtherParameter ::= ImageParamPage ImageParamUpright ImageParamBorder
ImageParamPage ::= "page=$1" "page $1"
ImageParamUpgright ::= "upright" "=" PositiveInteger
ImageParamBorder ::=
"border"
ImageSizeParameter ::=
PositiveNumber "px"
ImageAlignParameter ::= ImageAlignLeft ImageAlign Center ImageAlignRight ImageAlignNone
ImageAlignLeft ::=
"left"
ImageAlignCenter ::= "center" "centre"
ImageAlignRight ::=
"right"
ImageAlignNone ::=
"none"
ImageValignParameter ::= ImageValignBaseline ImageValignSub ImageValignSuper ImageValignTop ImageValignTextTop ImageValignMiddle ImageValignBottom ImageValignTextBottom
ImageValignBaseline ::=
"baseline"
ImageValignSub ::=
"sub"
ImageValignSuper ::= "super" "sup"
ImageValignTop ::=
"top"
ImageValignTextTop ::=
"text-top"
ImageValignMiddle ::=
"middle"
ImageValignBottom ::=
"bottom"
ImageValignTextBottom ::=
"text-bottom"
Caption ::= inline-text
MediaInline ::= "[[" "Media:" PageName "." MediaExtension "]]"
MediaExtension ::= "ogg" "wav"
GalleryBlock ::= "<gallery>" NewLine GalleryImage NewLine GalleryImage NewLine "</gallery>"
GalleryImage ::= to_be_defined_ ":" __essentially___foo_ "." _jpg ε caption
canonical-article-title ::=
canonical-page canonical-sub-pages
canonical-sub-pages ::=
canonical-sub-page canonical-sub-pages
canonical-sub-page ::= sub-page-separator canonical-page-chars
canonical-page ::=
canonical-page-first-char canonical-page-chars
canonical-page-chars ::=
canonical-page-char canonical-page-chars
canonical-page-first-char ::= ucase-letter digit underscore "." "." "." "?"
canonical-page-char ::= letter digit underscore "." "." "." "?"
sub-page-separator ::=
"/"
article-title ::=
page sub-pages
sub-pages ::=
sub-page sub-pages
sub-page ::= sub-page-separator page-chars
page ::=
page-first-char page-chars
page-chars ::=
page-char page-chars
page-first-char ::= canonical-page-first-char lcase-letter "." "." "." "?"
page-char ::= canonical-page-char space "." "." "." "?"
wiki-page ::= redirect articlearticle
redirect ::= redirect-tag characters internal-link-start article-linkinternal-link-end pipe EOL
redirect-tag ::= FROM_LANGUAGE_FILE
article ::= special-block-and-more paragraph-and-more
special-block-and-more ::= special-blockEOF newline special-block-and-more newline ε paragraph-and-more
paragraph-and-more ::= paragraphEOF newline special-block-and-more newline paragraph-and-more
paragraph ::=
newline lines-of-text
lines-of-textlines-of-text ::=
line-of-text lines-of-text
line-of-text ::= inline-text newline
link ::= internal-link external-link
internal-link ::= internal-link-start article-link "#" section-id pipe link-description internal-link-end extra-description
article-link ::= ":" namespace-prefix article-titleinterwiki-prefix
article-link ::= ":" namespace-prefix article-title "/" article-title "../" article-titleinterwiki-prefix
article-title ::= "%"title-legal-chars
title-legal-chars ::= " " "%" "!" """ "$" "&" "'" "(" ")" "*" "," "-" "." "/" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" ":" ";" "=" "?" "@" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "\" "^" "_" "`" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "~" "" "" "" "" "" " " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " " "¡" "¢" "£" "¤" "¥" "¦" "§" "¨" "©" "ª" "«" "¬" "" "®" "¯" "°" "±" "²" "³" "´" "µ" "¶" "·" "¸" "¹" "º" "»" "¼" "½" "¾" "¿" "À" "Á" "Â" "Ã" "Ä" "Å" "Æ" "Ç" "È" "É" "Ê" "Ë" "Ì" "Í" "Î" "Ï" "Ð" "Ñ" "Ò" "Ó" "Ô" "Õ" "Ö" "×" "Ø" "Ù" "Ú" "Û" "Ü" "Ý" "Þ" "ß" "à" "á" "â" "ã" "ä" "å" "æ" "ç" "è" "é" "ê" "ë" "ì" "í" "î" "ï" "ð" "ñ" "ò" "ó" "ô" "õ" "ö" "÷" "ø" "ù" "ú" "û" "ü" "ý" "þ" "ÿ" "+"
interwiki-prefix ::=
interwiki ":"
interwiki ::= STRING_FROM_DB
namespace-prefix ::= namespace":"
namespace ::= STRING_FROM_CONFIG
link-description ::= LEGAL_ARTICLE_ENTITY
extra-description ::=
letter extra-description
internal-link-start ::=
"[["
internal-link-end ::=
"]]"
pipe ::=
"|"
section-id ::= "%""#"title-legal-chars
category ::= internal-link-start category-namespace ":" article-title pipe sort-key internal-link-end
category-namespace ::= NS_CATEGORY
external-link ::= external-link-start url whitespacelink-description external-link-end url
url ::= protocol url-path
protocol ::= ALLOWED_PROTOCOL_FROM_CONFIG "." g "." "http://" "," "mailto:"e
url-path ::=
url-char url-path
url-char ::= LEGAL_URL_ENTITY
external-link-start ::=
"["
external-link-end ::=
"]"
magic-link ::= isbn rfc-number pmid-number
isbn ::= "ISBN" " " "+" isbn-number "?" non-word-character "/" "\" b "/"
isbn-number ::= "97" "8""9" " ""-" "?" DIGIT " ""-" "?" "9" DIGIT"X""x"
rfc-number ::=
"RFC" spaces digits
pmid-number ::=
"PMID" spaces digits
special-block ::= horizontal-rule heading list-item nowiki table / nowiki space-block "." "." "."
horizontal-rule ::= "----" dashes inline-text newline
dashes ::= "-" dashes
heading ::= level-6-heading level-5-heading level-4-heading level-3-heading level-2-heading level-1-heading
level-6-heading ::= "======" inline-text "======" space-tabs newline
level-5-heading ::= "=====" inline-text "=====" space-tabs newline
level-4-heading ::= "====" inline-text "====" space-tabs newline
level-3-heading ::= "===" inline-text "===" space-tabs newline
level-2-heading ::= "==" inline-text "==" space-tabs newline
level-1-heading ::= "=" inline-text "=" space-tabs newline
list-item ::= indent-item enumerated-item bullet-item
indent-item ::= ":" list-item item-body
enumerated-item ::= "#" list-item item-body
bullet-item ::= "*" list-item item-body
item-body ::=
defined-term
whitespace
inline-textdefined-term ::= ";" text definition
definition ::=
":" inline-text
space-block ::= " " inline-text newline space-block-2
space-block-2 ::= " " inline-text newline
inline-text ::=
inline-element inline-text
inline-element ::= category-link internal-link external-link magic-link image-inline gallery-block media-inline text-with-formatting
text-with-formatting ::= formatting inline-html noparseblock behaviour-switch open-guillemet close-guillemet html-entity html-unsafe-symbol text random-character "?" "." "." "."more missing
text ::=
harmless-character
html-entity ::= "&" html-entity-name ";" "&#" decimal-number ";" "&#x" hex-number ";"
html-entity-name ::= Sanitizer ":" ":" "$" wgHtmlEntities case sensitive "*" "Aacute""aacute""." "." "." "*"
html-unsafe-symbol ::= unescaped-ampersand unespaced-less-than unescaped-greater-than
unescaped-ampersand ::=
"&"
unescaped-less-than ::=
"<"
unescaped-greater-than ::=
">"
harmless-characters ::= "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
random-character ::= "?" any character "." "." "." "?"
character ::= whitespace-char non-whitespace-char html-entity
whitespace ::=
whitespace-char whitespace
EOFnewlines ::=
newline newlines
space-tabs ::=
space-tab space-tabs
whitespace-char ::= space-tab newline
space-tab ::= space TAB
spaces ::=
space spaces
space ::=
" "
newline ::= CR LF LF CR CR LF
BOL ::= newline BOF
EOL ::= newline EOF
non-whitespace-char ::= letter decimal-digit symbol
letter ::= ucase-letter lcase-letter
ucase-letter ::= "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"
lcase-letter ::= "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
symbol ::= html-unsafe-symbol underscore "." "," "." "." "."
underscore ::=
"_"
decimal-number ::=
decimal-digit decimal-number
decimal-digit ::= "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
hex-number ::=
hex-digit hex-number
hex-digit ::= decimal-digit "A" "B" "C" "D" "E" "F" "a" "b" "c" "d" "e" "f"
formatting ::= bold-italic-toggle bold-toggle italic-toggle
bold-italic-toggle ::=
"'''''"
bold-toggle ::=
"'''"
italic-toggle ::=
"''"
formatting ::= apostrophe-jungle
apostrophe-jungle ::= "''" "'"
behaviour-switch ::= behaviourswitch-toc behaviourswitch-forcetoc behaviourswitch-notoc behaviourswitch-noeditsection behaviourswitch-nogallery
behaviourswitch-toc ::=
"__TOC__" i
behaviourswitch-forcetoc ::=
"__FORCETOC__" i
behaviourswitch-notoc ::=
"__NOTOC__" i
behaviourswitch-noeditsection ::=
"__NOEDITSECTION__" i
behaviourswitch-nogallery ::=
"__NOGALLERY__" i