Extension:TextExtracts

The TextExtracts extension provides an API which allows to retrieve plain-text or limited HTML (HTML with content for [https://github.com/wikimedia/mediawiki-extensions-TextExtracts/blob/master/extension.json#L38 some CSS classes] removed) extracts of page content.

Configuration settings

 * is an array of &lt;tag>, &lt;tag>.class, .&lt;class>, and #&lt;id> which will be excluded from extraction.
 * For example,  removes indented text, often used for non-templated hatnotes that are not desired in summaries.
 * [https://phabricator.wikimedia.org/diffusion/ETEX/browse/ TextExtracts.php] defines the defaults, of which the class "noexcerpt" is one - this may be added to any template to exclude it.
 * defines whether TextExtracts should provide its extracts to the os>Special:MyLanguage/Api:Opensearch| API module. The default is "false".

Caveats
There are various things to be aware of when using the API
 * We do not recommend the usage of `exsentences`. It does not work for HTML extracts and there are many edge cases for which it doesn't exist. For example "Arm. gen. Ing. John Smith was a soldier." will be treated as 4 sentences. We do not plan to fix this.
 * Inline images are stripped from the response (even in HTML mode). This means if you are using the Math extension and using formulae in your lead section they may not appear in the summary output.
 * In HTML mode we cannot guarantee well formed HTML. Resulting HTML may be invalid or malformed.
 * In plaintext mode:
 * citations may not be stripped (see T197266)
 * if a paragraph ends with an HTML tag e.g. ref tag, new lines may be dropped (see T201946).
 * new lines may be dropped after lists T208132

How can I remove content from a page preview/extract?
TextExtracts will strip any element that is marked with the class noexcerpt. This is provided by the global wgExtractsRemoveClasses.