API:Parsing wikitext

These API modules allow calling the parser for preprocessing and rendering.

Retrieving just the raw source wikitext can be done through prop=revisions.

expandtemplates
Returns preprocessed wikitext (comments stripped, templates expanded, etc.)

Parameters

 * : Wikitext to preprocess
 * : Act like the wikitext is on this page (default: )
 * This only really matters when parsing links to self (like this) or links to subpages.

Possible errors
None.

parse
Returns parsed wikitext

Parameters

 * : Wikitext to parse
 * : Act like the wikitext is on this page (default: )
 * This only really matters when parsing links to self (|like this) or links to subpages.
 * If you are interested in simply getting the rendered content of a page, you can bypass the api and simple add  to your url, like so:  . More info on parameters to index.php.
 * : Parse the content of this page. Cannot be used together with  or
 * : Which properties to get (all by default)
 * : The generated HTML
 * : A list of language links in the wikitext fragment
 * : A list of category links in the wikitext fragment
 * : A list of internal links in the wikitext fragment
 * : A list of templates used in the wikitext fragment
 * : A list of images used in the wikitext fragment
 * : A list of external links used in the wikitext fragment
 * : A list of sections present in the wikitext fragment
 * : If  was used, specify the ID of the revision parsed
 * : Do a pre-save-transform (makes  work properly, expands tildes to signatures, etc.)
 * : The language code ("uselang=en" for English, "uselang=fr" for French, and so on) of the language in which the text or the page should be parsed.
 * This is useful for language-dependent content, such as generated by the template at the Commons, or generally by things dependent on  . Prior to MediaWiki 1.17, this worked by accident; since 1.17, it works by design.

Possible errors

 * code: params
 * info: The page parameter cannot be used together with the text and title parameters
 * code: missingtitle
 * info: The page you specified doesn't exist.

Note: missingtitle is returned only for syntactically invalid page titles (eg. empty). Trying to fetching a missing page will return the rendered HTML of the "page missing" notice, not an error. However, you can check the revid attribute of &lt;param&gt;, which will always be "0" for missing pages.