MediaWiki API help

This is an auto-generated MediaWiki API documentation page.

Documentation and examples: https://www.mediawiki.org/wiki/API

action=parse

(main | parse)
  • This module requires read rights.

Parses content and returns parser output.

See the various prop-modules of action=query to get information from the current version of a page.

There are several ways to specify the text to parse:

  1. Specify a page or revision, using page, pageid, or oldid.
  2. Specify content explicitly, using text, title, and contentmodel.
  3. Specify only a summary to parse. prop should be given an empty value.
Parameters:
title

Title of page the text belongs to. If omitted, contentmodel must be specified, and API will be used as the title.

text

Text to parse. Use title or contentmodel to control the content model.

summary

Summary to parse.

page

Parse the content of this page. Cannot be used together with text and title.

pageid

Parse the content of this page. Overrides page.

redirects

If page or pageid is set to a redirect, resolve it.

oldid

Parse the content of this revision. Overrides page and pageid.

prop

Which pieces of information to get:

text
Gives the parsed text of the wikitext.
langlinks
Gives the language links in the parsed wikitext.
categories
Gives the categories in the parsed wikitext.
categorieshtml
Gives the HTML version of the categories.
links
Gives the internal links in the parsed wikitext.
templates
Gives the templates in the parsed wikitext.
images
Gives the images in the parsed wikitext.
externallinks
Gives the external links in the parsed wikitext.
sections
Gives the sections in the parsed wikitext.
revid
Adds the revision ID of the parsed page.
displaytitle
Adds the title of the parsed wikitext.
headitems
Gives items to put in the <head> of the page.
headhtml
Gives parsed <head> of the page.
modules
Gives the ResourceLoader modules used on the page.
indicators
Gives the HTML of page status indicators used on the page.
iwlinks
Gives interwiki links in the parsed wikitext.
wikitext
Gives the original wikitext that was parsed.
properties
Gives various properties defined in the parsed wikitext.
limitreportdata
Gives the limit report in a structured way. Gives no data, when disablepp is set.
limitreporthtml
Gives the HTML version of the limit report. Gives no data, when disablepp is set.
Values (separate with |): text, langlinks, categories, categorieshtml, links, templates, images, externallinks, sections, revid, displaytitle, headitems, headhtml, modules, indicators, iwlinks, wikitext, properties, limitreportdata, limitreporthtml
Default: text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties
pst

Do a pre-save transform on the input before parsing it. Only valid when used with text.

onlypst

Do a pre-save transform (PST) on the input, but don't parse it. Returns the same wikitext, after a PST has been applied. Only valid when used with text.

effectivelanglinks

Includes language links supplied by extensions (for use with prop=langlinks).

section

Only retrieve the content of this section number or when new generate a new section.

new section is only honored when specifying text.

sectiontitle

New section title when section is new.

Unlike page editing, this does not fall back to summary when omitted or empty.

disablepp

Disable the PP Report from the parser output.

disableeditsection

Disable edit section links from the parser output.

generatexml

Generate XML parse tree (requires content model wikitext).

preview

Parse in preview mode.

sectionpreview

Parse in section preview mode (enables preview mode too).

disabletoc

Disable table of contents in output.

contentformat

Content serialization format used for the input text. Only valid when used with text.

One value: text/x-wiki, text/javascript, application/json, text/css, text/plain
contentmodel

Content model of the input text. If omitted, title must be specified, and default will be the model of the specified title. Only valid when used with text.

One value: wikitext, javascript, json, css, text, Scribunto