Extension:StandardWikitext

From Linux Web Expert

MediaWiki extensions manual
StandardWikitext
Release status: experimental
Description Standardizes wikitext after each page save
Author(s) Sophivorustalk
Latest version 2.4
MediaWiki >= 1.39.0
PHP 7.4+
Database changes No
License GNU General Public License 3.0 or later
Download
Example [1]
  • $wgStandardWikitextAccount
  • $wgStandardWikitextNamespaces
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the StandardWikitext extension if it is available at translatewiki.net

The StandardWikitext extension standardizes wikitext after each page save. Use this extension to:

  • Fix messy wikitext
  • Fix some broken wikitext
  • Simplify regular expression search-and-replace
  • Simplify wikitext parsing by other tools
  • Eliminate OCD editing
  • End controversy over wikitext styles

This extension is inspired on JavaScript Standard Style. Enough of this madness!

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/StandardWikitext</tvar>|Download]] and move the extracted <tvar name=name>StandardWikitext</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/StandardWikitext
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'StandardWikitext' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Configuration

StandardWikitext is designed to work out of the box and needs no configuration. However, the following options are available, each one shown with its default value:

// Namespaces where to run wikitext standardization
$wgStandardWikitextNamespaces = [ NS_MAIN ];

// System account that will do the wikitext standardization
$wgStandardWikitextAccount = "StandardWikitext bot";

Modules

Wikitext is standardized to the following formats.

Sections

== Section ==

Text.

=== Sub-section ===

Text.

==== Sub-sub-section ====

Text.

Links

[[foo]]

[[foo]]s

[[Foo|bar]]

[[File:Foo.jpg|thumb|Caption]]

[[File:Foo.jpg|thumb|left|300px|Caption with [[sublink]].]]

Lists

* Foo
* Bar
* Baz

# Foo
# Bar
# Baz

* Foo
** Bar
*** Baz

Templates

{{Foo}}

{{Foo|bar|baz=qux}}

{{Foo
| bar
| baz = qux
}}

Tables

{| class="wikitable"
|+ Caption
! Header
! Header
|-
| Text
| Text
|-
| Text
| Text
|}

References

Text.<ref name="foo" group="bar">Reference</ref>

Text.<ref name="foo" />

Categories

Text.

[[Category:A]]
[[Category:B]]
[[Category:C]]

See also