CINXE.COM
Manual:Tag extensions - MediaWiki
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref--excluded vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Manual:Tag extensions - MediaWiki</title> <script>(function(){var className="client-js vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref--excluded vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )mediawikiwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""], "wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"74cecd4f-a5c8-4ac4-92f9-c167c5d5a8a8","wgCanonicalNamespace":"Manual","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":100,"wgPageName":"Manual:Tag_extensions","wgTitle":"Tag extensions","wgCurRevisionId":6680816,"wgRevisionId":6680816,"wgArticleId":15935,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Outdated pages","Pages to be merged","Customization techniques","MediaWiki development","Parser extensions","Sample code"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Manual:Tag_extensions","wgRelevantArticleId":15935,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgRestrictionEdit":["autoconfirmed"],"wgRestrictionMove":[],"wgNoticeProject":"mediawiki", "wgCiteReferencePreviewsActive":true,"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":30000,"wgTranslatePageTranslation":"source","wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"personal","wgULSisCompactLinksEnabled":true,"wgVector2022LanguageInHeader":false,"wgULSisLanguageSelectorEmpty":false,"wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"wgSiteNoticeId":"2.7"};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","mediawiki.action.styles":"ready","mediawiki.interface.helpers.styles":"ready", "mediawiki.codex.messagebox.styles":"ready","ext.translate.tag.languages":"ready","ext.pygments":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.translate.edit.documentation.styles":"ready","ext.translate":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.pt":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready","ext.dismissableSiteNotice.styles":"ready"};RLPAGEMODULES=["ext.pygments.view","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.translate.pagetranslation.uls","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.compactlinks","ext.uls.interface", "ext.checkUser.clientHints","ext.dismissableSiteNotice"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.dismissableSiteNotice.styles%7Cext.pygments%2Ctranslate%2CwikimediaBadges%7Cext.translate.edit.documentation.styles%7Cext.translate.tag.languages%7Cext.uls.pt%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cmediawiki.action.styles%7Cmediawiki.codex.messagebox.styles%7Cmediawiki.interface.helpers.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.6"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="noindex,nofollow,max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:site_name" content="MediaWiki"> <meta property="og:title" content="Manual:Tag extensions - MediaWiki"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//m.mediawiki.org/wiki/Manual:Tag_extensions"> <link rel="apple-touch-icon" href="/static/apple-touch/mediawiki.png"> <link rel="icon" href="/static/favicon/mediawiki.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="MediaWiki (en)"> <link rel="EditURI" type="application/rsd+xml" href="//www.mediawiki.org/w/api.php?action=rsd"> <link rel="canonical" href="https://www.mediawiki.org/wiki/Manual:Tag_extensions"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"> <link rel="alternate" type="application/atom+xml" title="MediaWiki Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-100 ns-subject page-Manual_Tag_extensions rootpage-Manual_Tag_extensions skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/MediaWiki" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-mw-download" class="mw-list-item"><a href="/wiki/Download"><span>Get MediaWiki</span></a></li><li id="n-mw-extensions" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Category:Extensions"><span>Get extensions</span></a></li><li id="n-blog-text" class="mw-list-item"><a href="https://techblog.wikimedia.org/"><span>Tech blog</span></a></li><li id="n-mw-contribute" class="mw-list-item"><a href="/wiki/Special:MyLanguage/How_to_contribute"><span>Contribute</span></a></li> </ul> </div> </div> <div id="p-support" class="vector-menu mw-portlet mw-portlet-support" > <div class="vector-menu-heading"> Support </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Help:Contents" title="The place to find out"><span>User help</span></a></li><li id="n-mw-faq" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:FAQ"><span>FAQ</span></a></li><li id="n-mw-manual" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:Contents"><span>Technical manual</span></a></li><li id="n-mw-supportdesk" class="mw-list-item"><a href="/wiki/Project:Support_desk"><span>Support desk</span></a></li><li id="n-mw-communication" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Communication"><span>Communication</span></a></li> </ul> </div> </div> <div id="p-development" class="vector-menu mw-portlet mw-portlet-development" > <div class="vector-menu-heading"> Development </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mw-developerportal" class="mw-list-item"><a href="https://developer.wikimedia.org/"><span>Developer portal</span></a></li><li id="n-svn-statistics" class="mw-list-item"><a href="/wiki/Development_statistics"><span>Code statistics</span></a></li> </ul> </div> </div> <div id="p-mediawiki.org" class="vector-menu mw-portlet mw-portlet-mediawiki_org" > <div class="vector-menu-heading"> mediawiki.org </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-portal" class="mw-list-item"><a href="/wiki/Project:Help" title="About the project, what you can do, where to find things"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes in the wiki [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-mw-translate" class="mw-list-item"><a href="/wiki/Special:LanguageStats"><span>Translate content</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Load a random page [x]" accesskey="x"><span>Random page</span></a></li><li id="n-mw-discussion" class="mw-list-item"><a href="/wiki/Project:Village_Pump"><span>Village pump</span></a></li><li id="n-Sandboxlink-portlet-label" class="mw-list-item"><a href="/wiki/Project:Sandbox"><span>Sandbox</span></a></li> </ul> </div> </div> <div id="p-lang" class="vector-menu mw-portlet mw-portlet-lang" > <div class="vector-menu-heading"> In other languages </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-add wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:NewItem?site=mediawikiwiki&page=Manual%3ATag+extensions" title="Add interlanguage links" class="wbc-editpage">Add links</a></span></div> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/MediaWiki" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/mediawikiwiki.svg" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="MediaWiki" src="/static/images/mobile/copyright/mediawikiwiki-wordmark.svg" style="width: 7.5em; height: 1.125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search MediaWiki [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search MediaWiki" aria-label="Search MediaWiki" autocapitalize="sentences" title="Search MediaWiki [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-uls" class="mw-list-item active user-links-collapsible-item"><a data-mw="interface" href="#" class="uls-trigger cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>English</span></a> </li> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=www.mediawiki.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=Manual%3ATag+extensions&returntoquery=oldid%3D6680816" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=Manual%3ATag+extensions&returntoquery=oldid%3D6680816" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="More options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=www.mediawiki.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=Manual%3ATag+extensions&returntoquery=oldid%3D6680816" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=Manual%3ATag+extensions&returntoquery=oldid%3D6680816" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><div id="mw-dismissablenotice-anonplace"></div><script>(function(){var node=document.getElementById("mw-dismissablenotice-anonplace");if(node){node.outerHTML="\u003Cdiv class=\"mw-dismissable-notice\"\u003E\u003Cdiv class=\"mw-dismissable-notice-close\"\u003E[\u003Ca tabindex=\"0\" role=\"button\"\u003Edismiss\u003C/a\u003E]\u003C/div\u003E\u003Cdiv class=\"mw-dismissable-notice-body\"\u003E\u003C!-- CentralNotice --\u003E\u003Cdiv id=\"localNotice\" data-nosnippet=\"\"\u003E\u003Cdiv class=\"sitenotice\" lang=\"en\" dir=\"ltr\"\u003E\u003Ccenter\u003E\n\u003Cdiv style=\"width:100%; border-style:solid; border-width:2px; border-color:var(--color-placeholder, black); text-align:center; padding: 6px; margin-bottom: 3px;\"\u003E💬📄 On December 16, Flow/Structured Discussions pages on this wiki will be automatically archived (moved to a subpage) and set to read-only. The original pages will then become standard discussion pages. If you want to archive your talk page earlier, please \u003Ca href=\"/wiki/Structured_Discussions/Deprecation/Requests\" title=\"Structured Discussions/Deprecation/Requests\"\u003Eadd your page to this list\u003C/a\u003E.\n\u003C/div\u003E\n\u003Cdiv style=\"width:100%;border-style:solid; border-width:2px; border-color:var(--color-placeholder, black); text-align:center; padding: 6px;\"\u003E🗳️🖥️ The Wikimedia Foundation \u003Ca href=\"/wiki/Special:MyLanguage/Developer_Satisfaction_Survey/December_2024/announcement\" title=\"Special:MyLanguage/Developer Satisfaction Survey/December 2024/announcement\"\u003EDecember 2024 Developer Satisfaction Survey\u003C/a\u003E is now live.\nThis survey is used to measure developer satisfaction, \u0026amp; determine where to invest resources in the future.\u003C/div\u003E\n\u003C/center\u003E\u003C/div\u003E\u003C/div\u003E\u003C/div\u003E\u003C/div\u003E";}}());</script></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">Beginning</div> </a> </li> <li id="toc-Example" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Example"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Example</span> </div> </a> <ul id="toc-Example-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Attributes" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Attributes"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Attributes</span> </div> </a> <ul id="toc-Attributes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Conventions" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Conventions"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Conventions</span> </div> </a> <ul id="toc-Conventions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Publishing_your_extensions" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Publishing_your_extensions"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Publishing your extensions</span> </div> </a> <ul id="toc-Publishing_your_extensions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-FAQ" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#FAQ"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>FAQ</span> </div> </a> <button aria-controls="toc-FAQ-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle FAQ subsection</span> </button> <ul id="toc-FAQ-sublist" class="vector-toc-list"> <li id="toc-Security_concerns" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Security_concerns"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.1</span> <span>Security concerns</span> </div> </a> <ul id="toc-Security_concerns-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Loading_modules" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Loading_modules"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.2</span> <span>Loading modules</span> </div> </a> <ul id="toc-Loading_modules-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Timing_and_extensions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Timing_and_extensions"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.3</span> <span>Timing and extensions</span> </div> </a> <ul id="toc-Timing_and_extensions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-How_do_I_disable_caching_for_pages_using_my_extension?" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#How_do_I_disable_caching_for_pages_using_my_extension?"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.4</span> <span>How do I disable caching for pages using my extension?</span> </div> </a> <ul id="toc-How_do_I_disable_caching_for_pages_using_my_extension?-sublist" class="vector-toc-list"> <li id="toc-Regenerating_the_page_when_another_page_is_edited" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Regenerating_the_page_when_another_page_is_edited"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.4.1</span> <span>Regenerating the page when another page is edited</span> </div> </a> <ul id="toc-Regenerating_the_page_when_another_page_is_edited-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Fine_grained_adjustment_of_caching_behavior" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Fine_grained_adjustment_of_caching_behavior"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.5</span> <span>Fine grained adjustment of caching behavior</span> </div> </a> <ul id="toc-Fine_grained_adjustment_of_caching_behavior-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-How_do_I_render_wikitext_in_my_extension?" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#How_do_I_render_wikitext_in_my_extension?"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.6</span> <span>How do I render wikitext in my extension?</span> </div> </a> <ul id="toc-How_do_I_render_wikitext_in_my_extension?-sublist" class="vector-toc-list"> <li id="toc-Since_version_1.16" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Since_version_1.16"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.6.1</span> <span>Since version 1.16</span> </div> </a> <ul id="toc-Since_version_1.16-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-How_can_I_pass_XML-style_parameters_in_my_extension_tag?" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#How_can_I_pass_XML-style_parameters_in_my_extension_tag?"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.7</span> <span>How can I pass XML-style parameters in my extension tag?</span> </div> </a> <ul id="toc-How_can_I_pass_XML-style_parameters_in_my_extension_tag?-sublist" class="vector-toc-list"> <li id="toc-Since_version_1.5" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Since_version_1.5"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.7.1</span> <span>Since version 1.5</span> </div> </a> <ul id="toc-Since_version_1.5-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-How_can_I_avoid_modification_of_my_extension's_HTML_output?" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#How_can_I_avoid_modification_of_my_extension's_HTML_output?"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.8</span> <span>How can I avoid modification of my extension's HTML output?</span> </div> </a> <ul id="toc-How_can_I_avoid_modification_of_my_extension's_HTML_output?-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-How_do_I_get_my_extension_to_show_up_on_Special:Version?" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#How_do_I_get_my_extension_to_show_up_on_Special:Version?"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.9</span> <span>How do I get my extension to show up on Special:Version?</span> </div> </a> <ul id="toc-How_do_I_get_my_extension_to_show_up_on_Special:Version?-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Retrieving_the_tag_name_inside_of_the_callback" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Retrieving_the_tag_name_inside_of_the_callback"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.10</span> <span>Retrieving the tag name inside of the callback</span> </div> </a> <ul id="toc-Retrieving_the_tag_name_inside_of_the_callback-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Toolbar_buttons" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Toolbar_buttons"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.11</span> <span>Toolbar buttons</span> </div> </a> <ul id="toc-Toolbar_buttons-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-namespace">Manual</span><span class="mw-page-title-separator">:</span><span class="mw-page-title-main">Tag extensions</span></h1> <div class="mw-indicators"> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-manual" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Manual:Tag_extensions" title="View the subject page [c]" accesskey="c"><span>Manual</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Manual_talk:Tag_extensions" rel="discussion" title="Discussion about the content page [t]" accesskey="t"><span>Discussion</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Manual:Tag_extensions"><span>Read</span></a></li><li id="ca-viewsource" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Manual:Tag_extensions&action=edit" title="This page is protected. You can view its source [e]" accesskey="e"><span>View source</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Manual:Tag_extensions&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Manual:Tag_extensions"><span>Read</span></a></li><li id="ca-more-viewsource" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Manual:Tag_extensions&action=edit"><span>View source</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Manual:Tag_extensions&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Manual:Tag_extensions" title="A list of all wiki pages that link here [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Manual:Tag_extensions" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//commons.wikimedia.org/wiki/Special:UploadWizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Manual:Tag_extensions&oldid=6680816" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Manual:Tag_extensions&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=Manual%3ATag_extensions&id=6680816&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlQ%C4%B1sald%C4%B1c%C4%B1s%C4%B1&url=https%3A%2F%2Fwww.mediawiki.org%2Fw%2Findex.php%3Ftitle%3DManual%3ATag_extensions%26oldid%3D6680816"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrKodu&url=https%3A%2F%2Fwww.mediawiki.org%2Fw%2Findex.php%3Ftitle%3DManual%3ATag_extensions%26oldid%3D6680816"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-create_a_book" class="mw-list-item"><a href="/w/index.php?title=Special:Book&bookcmd=book_creator&referer=Manual%3ATag+extensions"><span>Create a book</span></a></li><li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Manual%3ATag_extensions&action=show-download-screen"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Manual:Tag_extensions&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects emptyPortlet" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div id="siteSub" class="noprint">From mediawiki.org</div> </div> <div id="contentSub"><div id="mw-content-subtitle"><div class="cdx-message cdx-message--block cdx-message--warning mw-revision"><span class="cdx-message__icon"></span><div class="cdx-message__content"><div id="mw-revision-info">Revision as of 03:13, 31 July 2024 by <a href="/wiki/User:Samwilson" class="mw-userlink" title="User:Samwilson" data-mw-revid="6680816"><bdi>Samwilson</bdi></a> <span class="mw-usertoollinks">(<a href="/wiki/User_talk:Samwilson" class="mw-usertoollinks-talk" title="User talk:Samwilson">talk</a> | <a href="/wiki/Special:Contributions/Samwilson" class="mw-usertoollinks-contribs" title="Special:Contributions/Samwilson">contribs</a>)</span> <span class="comment">(Update example to implement hook interface.)</span></div><div id="mw-revision-nav">(<a href="/w/index.php?title=Manual:Tag_extensions&diff=prev&oldid=6680816" title="Manual:Tag extensions">diff</a>) <a href="/w/index.php?title=Manual:Tag_extensions&direction=prev&oldid=6680816" title="Manual:Tag extensions">← Older revision</a> | Latest revision (diff) | Newer revision → (diff)</div></div></div></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="mw-pt-languages noprint navigation-not-searchable" lang="en" dir="ltr"><div class="mw-pt-languages-label">Languages:</div><ul class="mw-pt-languages-list"><li><a href="/wiki/Manual:Tag_extensions/de" class="mw-pt-progress mw-pt-progress--med" title="Handbuch:Tag Erweiterungen (17% translated)" lang="de" dir="ltr">Deutsch</a></li> <li><span class="mw-pt-languages-ui mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete" lang="en" dir="ltr">English</span></li> <li><a href="/wiki/Manual:Tag_extensions/eo" class="mw-pt-progress mw-pt-progress--low" title="Manlibro:Etikedaj etendaĵoj (6% translated)" lang="eo" dir="ltr">Esperanto</a></li> <li><a href="/wiki/Manual:Tag_extensions/tr" class="mw-pt-progress mw-pt-progress--high" title="Manual:Etiket uzantıları (86% translated)" lang="tr" dir="ltr">Türkçe</a></li> <li><a href="/wiki/Manual:Tag_extensions/yo" class="mw-pt-progress mw-pt-progress--low" title="Manual:Tag extensions/yo (3% translated)" lang="yo" dir="ltr">Yorùbá</a></li> <li><a href="/wiki/Manual:Tag_extensions/es" class="mw-pt-progress mw-pt-progress--high" title="Manual:Extensiones de etiquetas (84% translated)" lang="es" dir="ltr">español</a></li> <li><a href="/wiki/Manual:Tag_extensions/fr" class="mw-pt-progress mw-pt-progress--complete" title="Extensions de balise (100% translated)" lang="fr" dir="ltr">français</a></li> <li><a href="/wiki/Manual:Tag_extensions/pl" class="mw-pt-progress mw-pt-progress--low" title="Manual:Tag extensions/pl (3% translated)" lang="pl" dir="ltr">polski</a></li> <li><a href="/wiki/Manual:Tag_extensions/pt" class="mw-pt-progress mw-pt-progress--low" title="Manual:Extensões de Etiqueta (11% translated)" lang="pt" dir="ltr">português</a></li> <li><a href="/wiki/Manual:Tag_extensions/pt-br" class="mw-pt-progress mw-pt-progress--low" title="Manual:Desenvolvendo extensões (12% translated)" lang="pt-BR" dir="ltr">português do Brasil</a></li> <li><a href="/wiki/Manual:Tag_extensions/sv" class="mw-pt-progress mw-pt-progress--low" title="Manual:Taggtillägg (8% translated)" lang="sv" dir="ltr">svenska</a></li> <li><a href="/wiki/Manual:Tag_extensions/cs" class="mw-pt-progress mw-pt-progress--high" title="Příručka:Rozšíření značek (tagů) (94% translated)" lang="cs" dir="ltr">čeština</a></li> <li><a href="/wiki/Manual:Tag_extensions/ru" class="mw-pt-progress mw-pt-progress--med" title="Руководство:Теги расширений (17% translated)" lang="ru" dir="ltr">русский</a></li> <li><a href="/wiki/Manual:Tag_extensions/uk" class="mw-pt-progress mw-pt-progress--low" title="Посібник:Теги розширень (6% translated)" lang="uk" dir="ltr">українська</a></li> <li><a href="/wiki/Manual:Tag_extensions/ar" class="mw-pt-progress mw-pt-progress--complete" title="دليل:وسوم الامتدادات (100% translated)" lang="ar" dir="rtl">العربية</a></li> <li><a href="/wiki/Manual:Tag_extensions/zh" class="mw-pt-progress mw-pt-progress--high" title="Manual:标签扩展 (94% translated)" lang="zh" dir="ltr">中文</a></li> <li><a href="/wiki/Manual:Tag_extensions/ja" class="mw-pt-progress mw-pt-progress--med" title="Manual:タグ拡張機能 (34% translated)" lang="ja" dir="ltr">日本語</a></li> <li><a href="/wiki/Manual:Tag_extensions/ko" class="mw-pt-progress mw-pt-progress--low" title="Manual:태그 확장기능 (7% translated)" lang="ko" dir="ltr">한국어</a></li></ul></div> <style data-mw-deduplicate="TemplateStyles:r6651103">.mw-parser-output .nmbox{background:#f8f9fa;border:1px solid #AAA;box-sizing:border-box;margin:2px 0;padding:0}.mw-parser-output .nmbox *{box-sizing:border-box}.mw-parser-output .nmbox-header{background:#eaecf0;padding:4px 0.5em;font-weight:bold;text-align:center;white-space:nowrap}.mw-parser-output .nmbox .mbox-image{display:inline-block;padding-right:1em}.mw-parser-output .nmbox-text{border-top:1px solid #AAA;width:100%;padding:4px 0.5em}@media screen and (min-width:768px){.mw-parser-output .nmbox-header{display:table-cell;border-right:1px solid #AAA;width:1%}.mw-parser-output .nmbox-text{border-top:none;display:table-cell}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .nmbox-header,html.skin-theme-clientpref-night .mw-parser-output .nmbox{background:transparent;color:inherit}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .nmbox-header,html.skin-theme-clientpref-os .mw-parser-output .nmbox{background:transparent;color:inherit}}</style> <div class="nmbox noprint mw-content-ltr"><div class="nmbox-header"><div class="nmbox-image mbox-image"><span class="skin-invert" typeof="mw:File"><a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/f/fb/OOjs_UI_icon_puzzle-ltr.svg/20px-OOjs_UI_icon_puzzle-ltr.svg.png" decoding="async" width="20" height="20" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/f/fb/OOjs_UI_icon_puzzle-ltr.svg/30px-OOjs_UI_icon_puzzle-ltr.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/f/fb/OOjs_UI_icon_puzzle-ltr.svg/40px-OOjs_UI_icon_puzzle-ltr.svg.png 2x" data-file-width="20" data-file-height="20" /></a></span></div><b><a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions">Extensions:</a><span style="display:none"><a href="/wiki/Manual:Extensions" title="Manual:Extensions"> </a></span></b> </div> <div class="nmbox-text mbox-text"><style data-mw-deduplicate="TemplateStyles:r6387430">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li,.mw-parser-output .hlist .mw-empty-elt{display:none}.mw-parser-output .hlist dt:after{content:": "}.mw-parser-output .hlist dd:after,.mw-parser-output .hlist li:after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child:after,.mw-parser-output .hlist dt:last-child:after,.mw-parser-output .hlist li:last-child:after{content:none}.mw-parser-output .hlist dd dd:first-child:before,.mw-parser-output .hlist dd dt:first-child:before,.mw-parser-output .hlist dd li:first-child:before,.mw-parser-output .hlist dt dd:first-child:before,.mw-parser-output .hlist dt dt:first-child:before,.mw-parser-output .hlist dt li:first-child:before,.mw-parser-output .hlist li dd:first-child:before,.mw-parser-output .hlist li dt:first-child:before,.mw-parser-output .hlist li li:first-child:before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child:after,.mw-parser-output .hlist dd dt:last-child:after,.mw-parser-output .hlist dd li:last-child:after,.mw-parser-output .hlist dt dd:last-child:after,.mw-parser-output .hlist dt dt:last-child:after,.mw-parser-output .hlist dt li:last-child:after,.mw-parser-output .hlist li dd:last-child:after,.mw-parser-output .hlist li dt:last-child:after,.mw-parser-output .hlist li li:last-child:after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li:before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child:before,.mw-parser-output .hlist dt ol>li:first-child:before,.mw-parser-output .hlist li ol>li:first-child:before{content:" ("counter(listitem)"\a0 "}</style><div class="hlist"> <ul><li><a href="/wiki/Special:MyLanguage/Manual:Developing_extensions" title="Special:MyLanguage/Manual:Developing extensions">Development</a><span style="display:none"><a href="/wiki/Manual:Developing_extensions" title="Manual:Developing extensions"> </a></span></li> <li><b><a href="/wiki/Special:MyLanguage/Manual:Tag_extensions" title="Special:MyLanguage/Manual:Tag extensions">Tag extensions</a></b><span style="display:none"><a class="mw-selflink selflink"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Parser_functions" title="Special:MyLanguage/Manual:Parser functions">Parser functions</a><span style="display:none"><a href="/wiki/Manual:Parser_functions" title="Manual:Parser functions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Hooks" title="Special:MyLanguage/Manual:Hooks">Hooks</a><span style="display:none"><a href="/wiki/Manual:Hooks" title="Manual:Hooks"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Special_pages" title="Special:MyLanguage/Manual:Special pages">Special pages</a><span style="display:none"><a href="/wiki/Manual:Special_pages" title="Manual:Special pages"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Skins" title="Special:MyLanguage/Manual:Skins">Skins</a><span style="display:none"><a href="/wiki/Manual:Skins" title="Manual:Skins"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Magic_words" title="Special:MyLanguage/Manual:Magic words">Magic words</a><span style="display:none"><a href="/wiki/Manual:Magic_words" title="Manual:Magic words"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/API:Extensions" title="Special:MyLanguage/API:Extensions">API</a><span style="display:none"><a href="/wiki/API:Extensions" title="API:Extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Page_content_models" title="Special:MyLanguage/Manual:Page content models">Content models</a><span style="display:none"><a href="/wiki/Manual:Page_content_models" title="Manual:Page content models"> </a></span></li></ul> </div></div> </div> <figure class="mw-halign-right" typeof="mw:File"><a href="/wiki/File:MediaWiki-extensions-icon.svg" class="mw-file-description"><img alt="MediaWiki extensions" src="//upload.wikimedia.org/wikipedia/commons/thumb/2/23/MediaWiki-extensions-icon.svg/125px-MediaWiki-extensions-icon.svg.png" decoding="async" width="125" height="84" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/2/23/MediaWiki-extensions-icon.svg/188px-MediaWiki-extensions-icon.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/2/23/MediaWiki-extensions-icon.svg/250px-MediaWiki-extensions-icon.svg.png 2x" data-file-width="686" data-file-height="463" /></a><figcaption></figcaption></figure> <p>Individual projects will often find it useful to <b>extend the built-in wiki markup</b> with additional capabilities, whether simple string processing, or full-blown information retrieval. Tag extensions allow users to create new custom tags that do just that. For example, one might use a tag extension to introduce a simple <style data-mw-deduplicate="TemplateStyles:r4673781">.mw-parser-output .nowrap,.mw-parser-output .nowrap a:before,.mw-parser-output .nowrap .selflink:before{white-space:nowrap}</style><code class="mw-highlight nowrap"><span class="p">‎<</span><span class="nt">donation</span> <span class="p">/></span></code> tag, which injects a donation form into the page. Extensions, including <a href="/wiki/Special:MyLanguage/Manual:Parser_Functions" title="Special:MyLanguage/Manual:Parser Functions">parser functions</a> and <a href="/wiki/Special:MyLanguage/Manual:Hooks" title="Special:MyLanguage/Manual:Hooks">hooks</a>, are the most effective way to change or enhance the functionality of MediaWiki. You should always check before you start work on an extension to make sure someone else hasn't done exactly what you are trying to do. </p><p>A simple tag extension consists of a <a href="https://en.wikipedia.org/wiki/Callback_(computer_science)" class="extiw" title="w:Callback (computer science)">callback</a> function, which is <a href="https://en.wikipedia.org/wiki/Hooking" class="extiw" title="w:Hooking">hooked</a> to the parser so that, when the parser runs, it will find and replace all instances of a specific tag, calling the corresponding callback function to render the actual HTML. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Example">Example</h2></div> <style data-mw-deduplicate="TemplateStyles:r6870138">.mw-parser-output table.ambox{margin:0 10%;width:unset;border:1px solid var(--border-color-base,#a2a9b1);border-left:10px solid var(--border-color-progressive,#36c);background-color:var(--background-color-neutral-subtle,#f8f9fa);box-sizing:border-box}.mw-parser-output table.ambox+table.ambox,.mw-parser-output table.ambox+link+table.ambox,.mw-parser-output table.ambox+style+table.ambox{margin-top:-1px}.mw-parser-output .ambox td.mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox th.mbox-text,.mw-parser-output .ambox td.mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox td.mbox-image{padding:2px 0 2px 0.5em}.mw-parser-output .ambox td.mbox-imageright{padding:2px 0.5em 2px 0}.mw-parser-output table.ambox-notice{border-left-color:var(--border-color-progressive,#36c)}.mw-parser-output table.ambox-speedy{background-color:var(--background-color-error-subtle,#fee7e6)}.mw-parser-output table.ambox-delete,.mw-parser-output table.ambox-speedy{border-left-color:var(--background-color-error--active,#b32424)}.mw-parser-output table.ambox-content{border-left-color:#f28500}.mw-parser-output table.ambox-style{border-left-color:#fc3}.mw-parser-output table.ambox-move{border-left-color:#9932cc}.mw-parser-output table.ambox-protection{border-left-color:var(--border-color-base,#a2a9b1)}html body.mediawiki .mw-parser-output .ambox.mbox-small{clear:right;float:right;margin:4px 0 4px 1em;box-sizing:border-box;width:238px;font-size:88%;line-height:1.25em}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;box-sizing:border-box;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}</style><table class="plainlinks ambox box-Update ambox-content ambox-Update metadata" role="presentation"><tbody><tr><td class="mbox-image"><div style="width:52px"><span typeof="mw:File"><span><img src="//upload.wikimedia.org/wikipedia/commons/thumb/9/9b/Gnome-appointment-soon.svg/45px-Gnome-appointment-soon.svg.png" decoding="async" width="45" height="45" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/9/9b/Gnome-appointment-soon.svg/68px-Gnome-appointment-soon.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/9/9b/Gnome-appointment-soon.svg/90px-Gnome-appointment-soon.svg.png 2x" data-file-width="48" data-file-height="48" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">Parts of this page (those related to Section) are <b>outdated</b>. <div class="hide-when-compact" style="display:inline;">It was written for an older version of MediaWiki and may not apply to the most recent version. If you have checked or updated this page and found the content to be suitable, please remove this notice.  See the <a href="/wiki/Manual_talk:Tag_extensions" title="Manual talk:Tag extensions">talk page</a> for a possible discussion on this. </div></div></td></tr></tbody></table> <p>In <a href="/wiki/Special:MyLanguage/Manual:Extension_registration" title="Special:MyLanguage/Manual:Extension registration">extension.json</a><span style="display:none"><a href="/wiki/Manual:Extension_registration" title="Manual:Extension registration"> </a></span>, set up the <a href="/wiki/Special:MyLanguage/Manual:Hooks" title="Special:MyLanguage/Manual:Hooks">hooks</a>: </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="err">...</span> <span class="w"> </span><span class="nt">"Hooks"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ParserFirstCallInit"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ExampleExtensionHooks"</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"HookHandlers"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtensionHooks"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"class"</span><span class="p">:</span><span class="w"> </span><span class="s2">"MediaWiki\\Extension\\ExampleExtension\\Hooks"</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span> <span class="err">...</span> </pre></div> <p>And add the hook into a PHP file </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?php</span> <span class="k">namespace</span> <span class="nx">MediaWiki\Extension\ExampleExtension</span><span class="p">;</span> <span class="k">class</span> <span class="nc">ExampleExtension</span> <span class="k">implements</span> <span class="nx">ParserFirstCallInitHook</span> <span class="p">{</span> <span class="c1">// Register any render callbacks with the parser</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">onParserFirstCallInit</span><span class="p">(</span> <span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// When the parser sees the <sample> tag, it executes renderTagSample (see below)</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setHook</span><span class="p">(</span> <span class="s1">'sample'</span><span class="p">,</span> <span class="p">[</span> <span class="nv">$this</span><span class="p">,</span> <span class="s1">'renderTagSample'</span> <span class="p">]</span> <span class="p">);</span> <span class="p">}</span> <span class="c1">// Render <sample></span> <span class="k">public</span> <span class="k">function</span> <span class="nf">renderTagSample</span><span class="p">(</span> <span class="nv">$input</span><span class="p">,</span> <span class="k">array</span> <span class="nv">$args</span><span class="p">,</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nx">PPFrame</span> <span class="nv">$frame</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// Nothing exciting here, just escape the user-provided input and throw it back out again (as example)</span> <span class="k">return</span> <span class="nb">htmlspecialchars</span><span class="p">(</span> <span class="nv">$input</span> <span class="p">);</span> <span class="p">}</span> <span class="p">}</span> </pre></div> <p>This example registers a callback function for the <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4673781"><code class="mw-highlight nowrap"><span class="p">‎<</span><span class="nt">sample</span><span class="p">></span></code> tag. When a user adds this tag to a page like this: <code class="mw-highlight mw-highlight-lang-html mw-content-ltr" dir="ltr"><span class="p"><</span><span class="nt">sample</span> <span class="na">arg1</span><span class="o">=</span><span class="s">"xxx"</span> <span class="na">arg2</span><span class="o">=</span><span class="s">"xxx"</span><span class="p">></span>...input...<span class="p"></</span><span class="nt">sample</span><span class="p">></span></code>, the parser will call the <code>renderTagSample()</code> function, passing in four arguments: </p> <dl><dt>$input</dt> <dd>Input between the <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4673781"><code class="mw-highlight nowrap"><span class="p">‎<</span><span class="nt">sample</span><span class="p">></span></code> and <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4673781"><code class="mw-highlight nowrap"><span class="p">‎</</span><span class="nt">sample</span><span class="p">></span></code> tags, or <b>null</b> if the tag is "closed", i.e. <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4673781"><code class="mw-highlight nowrap"><span class="p">‎<</span><span class="nt">sample</span> <span class="p">/></span></code></dd> <dt>$args</dt> <dd>Tag arguments, which are entered like HTML tag attributes; this is an associative array indexed by attribute name.</dd> <dt>$parser</dt> <dd>The parent parser (a Parser object); more advanced extensions use this to obtain the contextual Title, parse wiki text, expand braces, register link relationships and dependencies, etc.</dd> <dt>$frame</dt> <dd>The parent frame (a PPFrame object). This is used together with $parser to provide the parser with more complete information on the context in which the extension was called.</dd></dl> <p>For a more elaborate example, see <a href="/wiki/Special:MyLanguage/Manual:Tag_extensions/Example" title="Special:MyLanguage/Manual:Tag extensions/Example">Tag extension example</a> </p><p><br /> </p> <div class="mw-heading mw-heading2"><h2 id="Attributes">Attributes</h2></div> <p>Let's look at another example: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?php</span> <span class="nv">$wgHooks</span><span class="p">[</span><span class="s1">'ParserFirstCallInit'</span><span class="p">][]</span> <span class="o">=</span> <span class="s1">'onParserFirstCallInit'</span><span class="p">;</span> <span class="k">function</span> <span class="nf">onParserFirstCallInit</span><span class="p">(</span> <span class="nx">Parser</span> <span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setHook</span><span class="p">(</span> <span class="s1">'sample'</span><span class="p">,</span> <span class="s1">'wfSampleRender'</span> <span class="p">);</span> <span class="p">}</span> <span class="k">function</span> <span class="nf">wfSampleRender</span><span class="p">(</span> <span class="nv">$input</span><span class="p">,</span> <span class="k">array</span> <span class="nv">$args</span><span class="p">,</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nx">PPFrame</span> <span class="nv">$frame</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$attr</span> <span class="o">=</span> <span class="p">[];</span> <span class="c1">// This time, make a list of attributes and their values, and dump them, along with the user input</span> <span class="k">foreach</span><span class="p">(</span> <span class="nv">$args</span> <span class="k">as</span> <span class="nv">$name</span> <span class="o">=></span> <span class="nv">$value</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$attr</span><span class="p">[]</span> <span class="o">=</span> <span class="s1">'<strong>'</span> <span class="o">.</span> <span class="nb">htmlspecialchars</span><span class="p">(</span> <span class="nv">$name</span> <span class="p">)</span> <span class="o">.</span> <span class="s1">'</strong> = '</span> <span class="o">.</span> <span class="nb">htmlspecialchars</span><span class="p">(</span> <span class="nv">$value</span> <span class="p">);</span> <span class="p">}</span> <span class="k">return</span> <span class="nb">implode</span><span class="p">(</span> <span class="s1">'<br />'</span><span class="p">,</span> <span class="nv">$attr</span> <span class="p">)</span> <span class="o">.</span> <span class="s2">"</span><span class="se">\n\n</span><span class="s2">"</span> <span class="o">.</span> <span class="nb">htmlspecialchars</span><span class="p">(</span> <span class="nv">$input</span> <span class="p">);</span> <span class="sd">/**</span> <span class="sd"> * The following lines can be used to get the variable values directly:</span> <span class="sd"> * $to = $args['to'] ;</span> <span class="sd"> * $email = $args['email'] ;</span> <span class="sd"> */</span> <span class="p">}</span> </pre></div> <p>This example dumps the attributes passed to the tag, along with their values. It's quite evident that this allows for flexible specification of new, custom tags. You might, for example, define a tag extension that allows a user to inject a contact form on their user page, using something like <code class="mw-highlight mw-highlight-lang-html mw-content-ltr" dir="ltr"><span class="p"><</span><span class="nt">emailform</span> <span class="na">to</span><span class="o">=</span><span class="s">"User"</span> <span class="na">email</span><span class="o">=</span><span class="s">"user@foo.com"</span> <span class="p">/></span></code>. </p><p>There is a veritable plethora of tag extensions available for MediaWiki, some of which are <a href="/wiki/Special:MyLanguage/Category:Parser_extensions" title="Special:MyLanguage/Category:Parser extensions">listed on this site</a>; others can be found via a quick web search. While a number of these are quite specialised for their use case, there are a great deal of well-loved and well-used extensions providing varying degrees of functionality. </p> <div class="mw-heading mw-heading2"><h2 id="Conventions">Conventions</h2></div> <p>See <a href="/wiki/Special:MyLanguage/Manual:Developing_extensions" title="Special:MyLanguage/Manual:Developing extensions">Manual:Developing extensions</a><span style="display:none"><a href="/wiki/Manual:Developing_extensions" title="Manual:Developing extensions"> </a></span> for the general layout and setup of an extension. </p> <div class="mw-heading mw-heading2"><h2 id="Publishing_your_extensions">Publishing your extensions</h2></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6870138"><table class="plainlinks ambox ambox-move metadata" role="presentation"><tbody><tr><td class="mbox-image"><div style="width:52px"><span typeof="mw:File"><a href="/wiki/File:Merge-arrows.svg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/5/52/Merge-arrows.svg/50px-Merge-arrows.svg.png" decoding="async" width="50" height="20" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/5/52/Merge-arrows.svg/75px-Merge-arrows.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/5/52/Merge-arrows.svg/100px-Merge-arrows.svg.png 2x" data-file-width="50" data-file-height="20" /></a></span></div></td><td class="mbox-text"><div class="mbox-text-span">It has been suggested that this page or section be merged with <i><a href="/wiki/Manual:Developing_extensions#Deploying_and_registering#Publishing" title="Manual:Developing extensions">Manual:Developing extensions#Deploying and registering#Publishing</a></i>.(<a href="/wiki/Manual_talk:Tag_extensions" title="Manual talk:Tag extensions">Discuss</a>)</div></td></tr></tbody></table> <ol><li>Create a new page on this wiki named Extension:<extension_name> with information on your extension, how to install it, and screenshots of it in use. A convenient template has been created to hold this information called <a href="/wiki/Special:MyLanguage/Template:Extension" title="Special:MyLanguage/Template:Extension">Template:Extension</a><span style="display:none"><a href="/wiki/Template:Extension" title="Template:Extension"> </a></span>. See the template page for more information. You should also add as much detail as possible to the body of the page, and it is wise to check back fairly regularly to respond to user questions on the associated talk page. Also, make sure the page belongs to <a href="/wiki/Special:MyLanguage/Category:Extensions" title="Special:MyLanguage/Category:Extensions">Category:Extensions</a><span style="display:none"><a href="/wiki/Category:Extensions" title="Category:Extensions"> </a></span>.</li> <li>Extensions that create new <a href="/wiki/Special:MyLanguage/Manual:Hooks" title="Special:MyLanguage/Manual:Hooks">hooks</a> within the extension code should register them in the <a href="/wiki/Special:MyLanguage/Category:Extension_hooks" title="Special:MyLanguage/Category:Extension hooks">extension hook category</a>.</li> <li>Notify the <a href="https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/" class="extiw" title="mail:mediawiki-l">mediawiki-l</a> mailing list.</li></ol> <p>See also <a href="/wiki/Special:MyLanguage/Manual:Developing_extensions#Publishing_your_extension" title="Special:MyLanguage/Manual:Developing extensions">publishing your extension</a>. </p> <div class="mw-heading mw-heading2"><h2 id="FAQ">FAQ</h2></div> <div class="mw-heading mw-heading3"><h3 id="Security_concerns">Security concerns</h3></div> <p>You'll notice above that the input in the examples above is escaped using <code><a rel="nofollow" class="external text" href="https://php.net/function.htmlspecialchars">htmlspecialchars()</a></code> before being returned. It is vital that all user input is treated in this manner before echoing it back to the clients, to avoid introducing vectors for arbitrary <a href="https://en.wikipedia.org/wiki/Code_injection" class="extiw" title="w:Code injection">HTML injection</a>, which can lead to <a href="https://en.wikipedia.org/wiki/Cross-site_scripting" class="extiw" title="w:Cross-site scripting">cross-site scripting</a> vulnerabilities. </p> <div class="mw-heading mw-heading3"><h3 id="Loading_modules">Loading modules</h3></div> <p>The right way to add modules for your extension is to attach them to the ParserOutput rather than to $wgOut. The module list will then be automatically taken from the ParserOutput object and added to $wgOut even when the page rendering is pre-cached. If you are directly adding the modules to $wgOut they might not be cached in the parser output. </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">function</span> <span class="nf">myCoolHook</span><span class="p">(</span> <span class="nv">$text</span><span class="p">,</span> <span class="k">array</span> <span class="nv">$params</span><span class="p">,</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nx">PPFrame</span> <span class="nv">$frame</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// ... do stuff ...</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getOutput</span><span class="p">()</span><span class="o">-></span><span class="na">addModules</span><span class="p">(</span> <span class="s1">'ext.mycoolext'</span> <span class="p">);</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getOutput</span><span class="p">()</span><span class="o">-></span><span class="na">addModuleStyles</span><span class="p">(</span> <span class="s1">'ext.mycoolext.styles'</span> <span class="p">);</span> <span class="c1">// ... do more stuff ...</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Timing_and_extensions">Timing and extensions</h3></div> <p>If you change the code for an extension, all pages that use the extension will, theoretically, immediately reflect the results of new code. Technically speaking, this means your code is executed each and every time a page containing the extension is rendered. </p><p>In practice, this is often not the case, due to page caching - either by the MediaWiki software, the browser or by an intermediary proxy or firewall. </p><p>To bypass MediaWiki's parser cache and ensure a new version of the page is generated, click on edit, replace "action=edit" in the URL shown in the address bar of your browser by "action=purge" and submit the new URL. The page and all templates it references will be regenerated, ignoring all cached data. The purge action is needed if the main page itself is not modified, but the way it must be rendered has changed (the extension was modified, or only a referenced template was modified). </p><p>If this is not sufficient to get you a fresh copy of the page, you can normally bypass intermediary caches by adding '&rand=somerandomtext' to the end of the above URL. Make sure 'somerandomtext' is different every time. </p> <div class="mw-heading mw-heading3"><h3 id="How_do_I_disable_caching_for_pages_using_my_extension?"><span id="How_do_I_disable_caching_for_pages_using_my_extension.3F"></span>How do I disable caching for pages using my extension?</h3></div> <p>Since MediaWiki 1.5, the parser is passed as the third parameter to an extension. This parser can be used to invalidate the parser cache like this: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">function</span> <span class="nf">wfSampleSomeHookFunction</span><span class="p">(</span> <span class="nv">$text</span><span class="p">,</span> <span class="k">array</span> <span class="nv">$args</span><span class="p">,</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nx">PPFrame</span> <span class="nv">$frame</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getOutput</span><span class="p">()</span><span class="o">-></span><span class="na">updateCacheExpiry</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span> <span class="c1">// ...</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Regenerating_the_page_when_another_page_is_edited">Regenerating the page when another page is edited</h4></div> <p>Maybe you don't want to disable caching entirely, you just want the page to be regenerated whenever another page is edited, similar to the way that template transclusions are handled. This can be done using the parser object that is passed to your hook function and calling the <code>addTemplate</code>. </p><p><br /> </p> <div class="mw-heading mw-heading3"><h3 id="Fine_grained_adjustment_of_caching_behavior">Fine grained adjustment of caching behavior</h3></div> <p>You can use fine grained caching for your extension by using cache keys to differentiate between different versions of your extension output. While rendering you can add cache keys for every feature by adding an addExtraKey method to your hook function, e.g.: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">function</span> <span class="nf">wfSampleSomeHookFunction</span><span class="p">(</span> <span class="nv">$text</span><span class="p">,</span> <span class="k">array</span> <span class="nv">$args</span><span class="p">,</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nx">PPFrame</span> <span class="nv">$frame</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$userOptionsLookup</span> <span class="o">=</span> <span class="nx">MediaWikiServices</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-></span><span class="na">getUserOptionsLookup</span><span class="p">();</span> <span class="nv">$setting1</span><span class="o">=</span> <span class="p">(</span><span class="nx">int</span><span class="p">)</span><span class="nv">$userOptionsLookup</span><span class="o">-></span><span class="na">getOption</span><span class="p">(</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getUserIdentity</span><span class="p">(),</span> <span class="s1">'setting1'</span> <span class="p">);</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getOptions</span><span class="p">()</span><span class="o">-></span><span class="na">optionUsed</span><span class="p">(</span> <span class="s1">'setting1'</span> <span class="p">);</span> <span class="nv">$setting2</span><span class="o">=</span> <span class="p">(</span><span class="nx">int</span><span class="p">)</span><span class="nv">$userOptionsLookup</span><span class="o">-></span><span class="na">getOption</span><span class="p">(</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getUserIdentity</span><span class="p">(),</span> <span class="s1">'setting2'</span> <span class="p">);</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getOptions</span><span class="p">()</span><span class="o">-></span><span class="na">optionUsed</span><span class="p">(</span> <span class="s1">'setting2'</span> <span class="p">);</span> <span class="o">...</span> <span class="p">}</span> </pre></div> <p>However, modifying <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$parser</span><span class="o">-></span><span class="na">getOptions</span><span class="p">()</span></code> during parse means that the extra option keys aren't included when trying to get a cached page, only when rendering a page to go into cache, so you can use the <a href="/wiki/Special:MyLanguage/Manual:Hooks/PageRenderingHash" title="Special:MyLanguage/Manual:Hooks/PageRenderingHash">PageRenderingHash</a><span style="display:none"><a href="/wiki/Manual:Hooks/PageRenderingHash" title="Manual:Hooks/PageRenderingHash"> </a></span> hook to set extra options. PageRenderingHash is run both when putting a page into cache, and getting it out, so its important to only add new keys to the hash if they're not already there. e.g: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">$wgHooks</span><span class="p">[</span><span class="s1">'PageRenderingHash'</span><span class="p">][]</span> <span class="o">=</span> <span class="s1">'wfMyExtOnPageRenderingHash'</span><span class="p">;</span> <span class="k">function</span> <span class="nf">wfMyExtOnPageRenderingHash</span><span class="p">(</span> <span class="o">&</span><span class="nv">$confstr</span><span class="p">,</span> <span class="nv">$user</span><span class="p">,</span> <span class="nv">$optionsUsed</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$userOptionsLookup</span> <span class="o">=</span> <span class="nx">MediaWikiServices</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-></span><span class="na">getUserOptionsLookup</span><span class="p">();</span> <span class="k">if</span> <span class="p">(</span> <span class="nb">in_array</span><span class="p">(</span> <span class="s1">'setting1'</span><span class="p">,</span> <span class="nv">$optionsUsed</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$confstr</span> <span class="o">.=</span> <span class="s2">"!setting1="</span> <span class="o">.</span> <span class="nv">$userOptionsLookup</span><span class="o">-></span><span class="na">getOption</span><span class="p">(</span> <span class="nv">$user</span><span class="p">,</span> <span class="s1">'setting1'</span> <span class="p">);</span> <span class="p">}</span> <span class="k">if</span> <span class="p">(</span> <span class="nb">in_array</span><span class="p">(</span> <span class="s1">'setting2'</span><span class="p">,</span> <span class="nv">$optionsUsed</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$confstr</span> <span class="o">.=</span> <span class="s2">"!setting2="</span> <span class="o">.</span> <span class="nv">$userOptionsLookup</span><span class="o">-></span><span class="na">getOption</span><span class="p">(</span> <span class="nv">$user</span><span class="p">,</span> <span class="s1">'setting2'</span> <span class="p">);</span> <span class="p">}</span> <span class="p">}</span> </pre></div> <p>Some important notes on this: </p> <ul><li>Using "!setting1=$value" instead of just "!$value" in the confstr ensures that the parser cache does not become messed up if different extensions are installed or their load order changes. <i>!</i> is used a separator for different rendering options</li> <li>Some people use <code>$parser->getOptions()->addExtraKey()</code> instead of <code>$parser->getOptions()->optionUsed()</code>. Be warned that addExtraKey does not tell the parser cache that the extra key is in use, and thus can easily result in breaking the cache if you are not careful.</li></ul> <div class="mw-heading mw-heading3"><h3 id="How_do_I_render_wikitext_in_my_extension?"><span id="How_do_I_render_wikitext_in_my_extension.3F"></span>How do I render wikitext in my extension?</h3></div> <div class="mw-heading mw-heading4"><h4 id="Since_version_1.16">Since version 1.16</h4></div> <style data-mw-deduplicate="TemplateStyles:r4199130">.mw-parser-output .mw-version{border:1px solid #72777d;font-size:80%;line-height:1.2;border-collapse:collapse}.mw-parser-output .mw-version-ltr{float:right;margin:0 0 .5em .5em;text-align:right}.mw-parser-output .mw-version-rtl{float:left;margin:0 .5em .5em 0;text-align:left}.mw-parser-output .mw-version td{padding:.1em .3em}.mw-parser-output .mw-version-versionbox{border:5px solid #00af89;text-align:center}.mw-parser-output .mw-version-versionnumber{font-weight:bold;font-size:180%}.mw-parser-output .mw-version-version .mw-version-versionbox{border-color:#c8ccd1}.mw-parser-output .mw-version.mw-version-version2 .mw-version-versionbox{border-top-color:#c8ccd1;border-right-color:#c8ccd1;border-left-color:#c8ccd1}.mw-parser-output .mw-version-version-unsupported .mw-version-versionbox{border-color:#d33}.mw-parser-output .mw-version.mw-version-version2-unsupported .mw-version-versionbox{border-top-color:#d33;border-right-color:#d33;border-left-color:#d33}.mw-parser-output .mw-version-version-legacy .mw-version-versionbox{border-color:#f93}.mw-parser-output .mw-version.mw-version-version2-legacy .mw-version-versionbox{border-top-color:#f93;border-right-color:#f93;border-left-color:#f93}.mw-parser-output .mw-version-version-stable .mw-version-versionbox,.mw-parser-output .mw-version.mw-version.mw-version-and-later .mw-version-versionbox{border-color:#00af89}.mw-parser-output .mw-version.mw-version-version2-stable .mw-version-versionbox{border-top-color:#00af89;border-right-color:#00af89;border-left-color:#00af89}.mw-parser-output .mw-version-version-future .mw-version-versionbox{border-color:#8080c0}.mw-parser-output .mw-version.mw-version-version2-future .mw-version-versionbox{border-top-color:#8080c0;border-right-color:#8080c0;border-left-color:#8080c0}.mw-parser-output .mw-version-version-alpha .mw-version-versionbox{border-style:dotted}</style> <table class="mw-version mw-version-ltr mw-version-version mw-version-version-unsupported mw-version-and-later"><tbody><tr> <td>MediaWiki version:</td> <td class="mw-version-versionbox" title="The latest stable version is 1.42"><div class="mw-version-versionnumber"><small>≥</small> 1.16</div></td> </tr></tbody></table> <p>Parser hook functions are passed a reference to the parser object and a frame object; these should be used to parse wikitext. </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">function</span> <span class="nf">wfSampleWonderfulHook</span><span class="p">(</span> <span class="nv">$text</span><span class="p">,</span> <span class="k">array</span> <span class="nv">$args</span><span class="p">,</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nx">PPFrame</span> <span class="nv">$frame</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$output</span> <span class="o">=</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">recursiveTagParse</span><span class="p">(</span> <span class="nv">$text</span><span class="p">,</span> <span class="nv">$frame</span> <span class="p">);</span> <span class="k">return</span> <span class="s1">'<div class="wonderful">'</span> <span class="o">.</span> <span class="nv">$output</span> <span class="o">.</span> <span class="s1">'</div>'</span><span class="p">;</span> <span class="p">}</span> </pre></div> <p><code>Parser::recursiveTagParse()</code> has been around since version 1.8. Its advantages include simplicity (it takes just one argument and returns a string) and the fact that it parses extension tags in <code>$text</code>, so you can nest extension tags. </p><p>The second parameter to recursiveTagParse, <code>$frame</code>, is an optional argument introduced in MW 1.16 alpha (r55682). </p> <ul><li>If <code>$frame</code> is provided (using the value of <code>$frame</code> passed to your extension), then any template parameters in <code>$text</code> will be expanded. In other words, content such as <code>{{{1}}}</code> will be recognized and converted into the appropriate value.</li> <li>If <code>$frame</code> is not provided (e.g., <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$parser</span><span class="o">-></span><span class="na">recursiveTagParse</span><span class="p">(</span> <span class="nv">$text</span> <span class="p">)</span></code>), or if <code>$frame</code> is set to false, then template parameters will not be expanded; <code>{{{1}}}</code> will not be altered. Although this unlikely to be the desired behavior, this was the only option available before MW 1.16.</li></ul> <p>However, one step of parsing that is still skipped for tags, even when using recursiveTagParse, is <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">Parser</span><span class="o">::</span><span class="na">preSaveTransform</span></code>. preSaveTransform is the first step of parsing, responsible for making permanent changes to the about-to-be saved wikitext, such as: </p> <ul><li>Converting signatures (~~~, ~~~~, ~~~~~)</li> <li>Expanding link labels, also known as the <i>pipe-trick</i> (e.g., changing [[Help:Contents|]] into [[Help:Contents|Contents]]). Without this step, shorthand links such as [[Help:Contents|]] are considered to be invalid, and are left in their wikitext form when parsed.</li> <li>Expanding {{subst:}} templates.</li></ul> <p>The original call to preSaveTransform intentionally skips such conversions within all extension tags. If you need pre save transform to be done, you should consider using a <a href="/wiki/Special:MyLanguage/Manual:Parser_functions" title="Special:MyLanguage/Manual:Parser functions">parser function</a> instead. All tag extensions can also be called as a parser function using <code>{{#tag:tagname|input|attribute_name=value}}</code> which will have pre save transform applied. </p> <div class="mw-heading mw-heading3"><h3 id="How_can_I_pass_XML-style_parameters_in_my_extension_tag?"><span id="How_can_I_pass_XML-style_parameters_in_my_extension_tag.3F"></span>How can I pass XML-style parameters in my extension tag?</h3></div> <div class="mw-heading mw-heading4"><h4 id="Since_version_1.5">Since version 1.5</h4></div> <p>Since MediaWiki 1.5, XML-style parameters (tag attributes) are supported. The parameters are passed as the second parameter to the hook function, as an associative array. The value strings have already had HTML character entities decoded for you, so if you emit them back to HTML, don't forget to use <code>htmlspecialchars( $codeToEncode, ENT_QUOTES )</code>, to avoid the risk of HTML injection. </p> <div class="mw-heading mw-heading3"><h3 id="How_can_I_avoid_modification_of_my_extension's_HTML_output?"><span id="How_can_I_avoid_modification_of_my_extension.27s_HTML_output.3F"></span>How can I avoid modification of my extension's HTML output?</h3></div> <p>The return value of a tag extension is considered <i>almost</i> parsed text, which means its not treated as pure html, but still modified slightly. There are two main things that are done to the output of a tag extension (Along with a couple other minor things): </p> <ul><li>Replace <a href="/wiki/Strip_marker" title="Strip marker">strip markers</a>. Strip markers are certain items which are inserted at various stages of processing wikitext to act as a marker to re-insert removed content at a later time. This is not something extensions usually need to worry about.</li> <li><span class="plainlinks"><a class="external text" href="https://doc.wikimedia.org/mediawiki-core/master/php/classParser.html#ad463888e40c078ac9bcfcaf1231e39d7">Parser::doBlockLevels</a></span> which turns *'s into lists, and turns any line starting with a leading space into a <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4673781"><code class="mw-highlight nowrap"><span class="p">‎<</span><span class="nt">pre</span><span class="p">></span></code> among other things. This can sometimes be an issue in some extensions.</li></ul> <p>Tag extensions also support returning an array instead of just a string (Much like parser functions) in order to change how the return value is interpreted. The 0th value of the array must be the HTML. The "markerType" key can be set to <code>nowiki</code> in order to stop further parsing. Doing something like <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><span class="k">return</span> <span class="p">[</span> <span class="nv">$html</span><span class="p">,</span> <span class="s1">'markerType'</span> <span class="o">=></span> <span class="s1">'nowiki'</span> <span class="p">];</span></code> would ensure that the $html value is not further modified and treated as just plain html. </p> <div class="mw-heading mw-heading3"><h3 id="How_do_I_get_my_extension_to_show_up_on_Special:Version?"><span id="How_do_I_get_my_extension_to_show_up_on_Special:Version.3F"></span>How do I get my extension to show up on Special:Version?</h3></div> <p>In order for your extension to be displayed on the MediaWiki <a href="/wiki/Special:Version" title="Special:Version">Special:Version</a> page, you must assign extension credits within the PHP code. </p><p>To do this, add a <code><a href="/wiki/Special:MyLanguage/Manual:$wgExtensionCredits" title="Special:MyLanguage/Manual:$wgExtensionCredits">$wgExtensionCredits</a><span style="display:none"><a href="/wiki/Manual:$wgExtensionCredits" title="Manual:$wgExtensionCredits"> </a></span></code> variable as the first executable line of code before the hook line or function definition. </p><p>An example extension credit is: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?php</span> <span class="sd">/**</span> <span class="sd"> * ExampleExtension - this extension is an example that does nothing</span> <span class="sd"> *</span> <span class="sd"> * To activate this extension, add the following into your LocalSettings.php file:</span> <span class="sd"> * require_once('$IP/extensions/Example.php');</span> <span class="sd"> *</span> <span class="sd"> * @ingroup Extensions</span> <span class="sd"> * @author John Doe <john.doe@example.com></span> <span class="sd"> * @version 1.0</span> <span class="sd"> * @link https://www.mediawiki.org/wiki/Extension:MyExtension Documentation</span> <span class="sd"> * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later</span> <span class="sd"> */</span> <span class="sd">/**</span> <span class="sd"> * Protect against register_globals vulnerabilities.</span> <span class="sd"> * This line must be present before any global variable is referenced.</span> <span class="sd"> */</span> <span class="k">if</span><span class="p">(</span> <span class="o">!</span><span class="nb">defined</span><span class="p">(</span> <span class="s1">'MEDIAWIKI'</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span> <span class="k">echo</span><span class="p">(</span> <span class="s2">"This is an extension to the MediaWiki package and cannot be run standalone.</span><span class="se">\n</span><span class="s2">"</span> <span class="p">);</span> <span class="k">die</span><span class="p">(</span> <span class="o">-</span><span class="mi">1</span> <span class="p">);</span> <span class="p">}</span> <span class="c1">// Extension credits that will show up on Special:Version </span> <span class="nv">$wgExtensionCredits</span><span class="p">[</span><span class="s1">'validextensionclass'</span><span class="p">][]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span> <span class="s1">'path'</span> <span class="o">=></span> <span class="no">__FILE__</span><span class="p">,</span> <span class="s1">'name'</span> <span class="o">=></span> <span class="s1">'Example'</span><span class="p">,</span> <span class="s1">'version'</span> <span class="o">=></span> <span class="s1">'1.0'</span><span class="p">,</span> <span class="s1">'author'</span> <span class="o">=></span> <span class="s1">'John Doe'</span><span class="p">,</span> <span class="s1">'url'</span> <span class="o">=></span> <span class="s1">'https://www.mediawiki.org/wiki/Extension:MyExtension'</span><span class="p">,</span> <span class="s1">'descriptionmsg'</span> <span class="o">=></span> <span class="s1">'example-desc'</span><span class="p">,</span> <span class="c1">// Message key in i18n file.</span> <span class="s1">'description'</span> <span class="o">=></span> <span class="s1">'This extension is an example and performs no discernible function'</span> <span class="p">);</span> <span class="nv">$wgExtensionMessagesFiles</span><span class="p">[]</span> <span class="o">=</span> <span class="no">__DIR__</span> <span class="o">.</span> <span class="s1">'/Example.i18n.php'</span><span class="p">;</span> <span class="c1">// Here is where we set up our extension</span> <span class="k">function</span> <span class="nf">wfExample</span><span class="p">(){</span> <span class="c1">// ...</span> <span class="p">}</span> </pre></div> <p>Replace <code>validextensionclass</code> with one of the following (unless your extension falls under multiple classes—then create a credit for <i>each</i> class): </p> <ul><li>'specialpage'—reserved for additions to MediaWiki Special Pages;</li> <li>'parserhook'—used if your extension modifies, complements, or replaces the parser functions in MediaWiki;</li> <li>'variable'—extension that add multiple functionality to MediaWiki;</li> <li>'media'—used if your extension is a media handler of some sort</li> <li>'other'—all other extensions.</li></ul> <p>The <code>myextensionmsg</code> is the name of an interface/i18n message that describes your extension that will need to be defined in your extension's i18n.php file. If you omit this field, the <code>description</code> field will be used instead. </p> <div class="mw-heading mw-heading3"><h3 id="Retrieving_the_tag_name_inside_of_the_callback">Retrieving the tag name inside of the callback</h3></div> <p>Suppose you have several tags <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4673781"><code class="mw-highlight nowrap"><span class="p">‎<</span><span class="nt">foo</span><span class="p">></span></code> and <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4673781"><code class="mw-highlight nowrap"><span class="p">‎<</span><span class="nt">bar</span><span class="p">></span></code> that share the same callback, and inside the callback function, you want to obtain the <i>name of the tag</i> that invoked the callback. </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">$wgHooks</span><span class="p">[</span><span class="s1">'ParserFirstCallInit'</span><span class="p">][]</span> <span class="o">=</span> <span class="s1">'onParserFirstCallInit'</span><span class="p">;</span> <span class="c1"># ...</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">onParserFirstCallInit</span><span class="p">(</span> <span class="nx">Parser</span> <span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setHook</span><span class="p">(</span> <span class="s1">'foo'</span><span class="p">,</span> <span class="s1">'sharedFunctionality'</span> <span class="p">);</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setHook</span><span class="p">(</span> <span class="s1">'bar'</span><span class="p">,</span> <span class="s1">'sharedFunctionality'</span> <span class="p">);</span> <span class="p">}</span> <span class="c1"># ...</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">sharedFunctionality</span><span class="p">(</span> <span class="nv">$input</span><span class="p">,</span> <span class="k">array</span> <span class="nv">$args</span><span class="p">,</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nx">PPFrame</span> <span class="nv">$frame</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// How to distinguish between 'foo' and 'bar' calls?</span> <span class="p">}</span> </pre></div> <p>The short answer is: the tag name (<code>foo</code> or <code>bar</code>) is not present in any of the callback's arguments. But you can work around this by dynamically constructing a separate callback for each tag: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">$wgHooks</span><span class="p">[</span><span class="s1">'ParserFirstCallInit'</span><span class="p">][]</span> <span class="o">=</span> <span class="s1">'onParserFirstCallInit'</span><span class="p">;</span> <span class="c1"># ...</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">onParserFirstCallInit</span><span class="p">(</span> <span class="nx">Parser</span> <span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// For each tag name</span> <span class="k">foreach</span> <span class="p">(</span> <span class="p">[</span> <span class="s1">'foo'</span><span class="p">,</span> <span class="s1">'bar'</span> <span class="p">]</span> <span class="k">as</span> <span class="nv">$tagName</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// Dynamically create a callback function</span> <span class="nv">$callback</span> <span class="o">=</span> <span class="k">function</span><span class="p">(</span> <span class="nv">$input</span><span class="p">,</span> <span class="nv">$args</span><span class="p">,</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nv">$frame</span> <span class="p">)</span> <span class="k">use</span> <span class="p">(</span> <span class="nv">$tagName</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// The callback invokes the shared function.</span> <span class="c1">// Notice we now pass the tag name as a parameter.</span> <span class="k">return</span> <span class="nx">sharedFunctionality</span><span class="p">(</span> <span class="nv">$input</span><span class="p">,</span> <span class="nv">$args</span><span class="p">,</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nv">$frame</span><span class="p">,</span> <span class="nv">$tagName</span> <span class="p">);</span> <span class="p">};</span> <span class="c1">// Assign the callback to the tag</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setHook</span><span class="p">(</span> <span class="nv">$tagName</span><span class="p">,</span> <span class="nv">$callback</span> <span class="p">);</span> <span class="p">}</span> <span class="p">}</span> <span class="c1"># ...</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">sharedFunctionality</span><span class="p">(</span> <span class="nv">$input</span><span class="p">,</span> <span class="k">array</span> <span class="nv">$args</span><span class="p">,</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nx">PPFrame</span> <span class="nv">$frame</span><span class="p">,</span> <span class="nv">$tagName</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// Now we can retrieve the tag name and perform custom actions for that tag</span> <span class="k">switch</span> <span class="p">(</span> <span class="nv">$tagName</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">//...</span> <span class="p">}</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Toolbar_buttons">Toolbar buttons</h3></div> <p><a href="/wiki/Special:MyLanguage/Extension:WikiEditor" title="Special:MyLanguage/Extension:WikiEditor">Extension:WikiEditor</a><span style="display:none"><a href="/wiki/Extension:WikiEditor" title="Extension:WikiEditor"> </a></span> provides an editing toolbar, allowing users to add tags into their editor by simply clicking a button. If you want a toolbar button for your new tag, create a file named something like <code>toolbar-button.js</code> in your extension's <code>resources</code> folder. The file should look like this: </p> <div class="mw-highlight mw-highlight-lang-js mw-content-ltr" dir="ltr"><pre><span></span><span class="kd">var</span><span class="w"> </span><span class="nx">customizeToolbar</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kd">function</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">$</span><span class="p">(</span><span class="s1">'#wpTextbox1'</span><span class="p">).</span><span class="nx">wikiEditor</span><span class="p">(</span><span class="s1">'addToToolbar'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">section</span><span class="o">:</span><span class="w"> </span><span class="s1">'main'</span><span class="p">,</span> <span class="w"> </span><span class="nx">group</span><span class="o">:</span><span class="w"> </span><span class="s1">'format'</span><span class="p">,</span> <span class="w"> </span><span class="nx">tools</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="s2">"ExtensionName"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="c1">// replace with the name of your extension</span> <span class="w"> </span><span class="nx">label</span><span class="o">:</span><span class="w"> </span><span class="s1">'TagName'</span><span class="p">,</span><span class="w"> </span><span class="c1">// replace with the label that should appear when hoving the button</span> <span class="w"> </span><span class="nx">type</span><span class="o">:</span><span class="w"> </span><span class="s1">'button'</span><span class="p">,</span> <span class="w"> </span><span class="nx">icon</span><span class="o">:</span><span class="w"> </span><span class="s2">"extensions/ExtensionName/images/button-image.svg"</span><span class="p">,</span><span class="w"> </span><span class="c1">// path to the image that should go on the button</span> <span class="w"> </span><span class="nx">action</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">type</span><span class="o">:</span><span class="w"> </span><span class="s1">'encapsulate'</span><span class="p">,</span> <span class="w"> </span><span class="nx">options</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">pre</span><span class="o">:</span><span class="w"> </span><span class="s2">"<tagName>"</span><span class="p">,</span><span class="w"> </span><span class="c1">// tags that get inserted when the button is clicked</span> <span class="w"> </span><span class="nx">post</span><span class="o">:</span><span class="w"> </span><span class="s2">"</tagName>"</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">});</span> <span class="p">};</span> <span class="cm">/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */</span> <span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="s1">'edit'</span><span class="p">,</span><span class="w"> </span><span class="s1">'submit'</span><span class="w"> </span><span class="p">].</span><span class="nx">indexOf</span><span class="p">(</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="w"> </span><span class="s1">'wgAction'</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="o">!==</span><span class="w"> </span><span class="o">-</span><span class="mf">1</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">loader</span><span class="p">.</span><span class="nx">using</span><span class="p">(</span><span class="w"> </span><span class="s1">'user.options'</span><span class="w"> </span><span class="p">).</span><span class="nx">then</span><span class="p">(</span><span class="w"> </span><span class="kd">function</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="c1">// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">user</span><span class="p">.</span><span class="nx">options</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="w"> </span><span class="s1">'usebetatoolbar'</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mf">1</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nx">$</span><span class="p">.</span><span class="nx">when</span><span class="p">(</span> <span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">loader</span><span class="p">.</span><span class="nx">using</span><span class="p">(</span><span class="w"> </span><span class="s1">'ext.wikiEditor'</span><span class="w"> </span><span class="p">),</span><span class="w"> </span><span class="nx">$</span><span class="p">.</span><span class="nx">ready</span> <span class="w"> </span><span class="p">).</span><span class="nx">then</span><span class="p">(</span><span class="w"> </span><span class="nx">customizeToolbar</span><span class="w"> </span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">);</span> <span class="p">}</span> </pre></div> <p><a href="/wiki/Special:MyLanguage/Extension:WikiEditor/Toolbar_customization" title="Special:MyLanguage/Extension:WikiEditor/Toolbar customization">Further details about customizing this file can be found here</a>. Once you've created the file, you need to register it with <a href="/wiki/Special:MyLanguage/ResourceLoader" title="Special:MyLanguage/ResourceLoader">ResourceLoader</a><span style="display:none"><a href="/wiki/ResourceLoader" title="ResourceLoader"> </a></span> so it will be delivered to visitors; this is done by editing your <code>extension.json</code>: </p> <div class="mw-highlight mw-highlight-lang-js mw-content-ltr" dir="ltr"><pre><span></span><span class="s2">"Hooks"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="s2">"BeforePageDisplay"</span><span class="o">:</span><span class="w"> </span><span class="s2">"ExtensionName::onBeforePageDisplay"</span> <span class="p">}</span> <span class="s2">"ResourceModules"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="s2">"ext.ExtensionName"</span><span class="o">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="s2">"scripts"</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"toolbarButton.js"</span><span class="p">]</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> <p>Then, in your PHP file: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">onBeforePageDisplay</span><span class="p">(</span> <span class="nx">OutputPage</span> <span class="nv">$out</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$out</span><span class="o">-></span><span class="na">addModules</span><span class="p">(</span> <span class="p">[</span> <span class="s1">'ext.ExtensionName'</span> <span class="p">]</span> <span class="p">);</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div> <ul><li><a href="/wiki/Special:MyLanguage/Help:Magic_words" title="Special:MyLanguage/Help:Magic words">Help:Magic words</a><span style="display:none"><a href="/wiki/Help:Magic_words" title="Help:Magic words"> </a></span> – List of special tag/variables like {{PAGENAME}}, {{SERVER}}, ...</li> <li><a href="/wiki/Special:MyLanguage/Parser_extension_tags" title="Special:MyLanguage/Parser extension tags">Parser extension tags</a><span style="display:none"><a href="/wiki/Parser_extension_tags" title="Parser extension tags"> </a></span> – List of parser tags in use on Wikimedia wikis.</li> <li><a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions">Manual:Extensions</a><span style="display:none"><a href="/wiki/Manual:Extensions" title="Manual:Extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Extensions_FAQ" title="Special:MyLanguage/Extensions FAQ">Extensions FAQ</a><span style="display:none"><a href="/wiki/Extensions_FAQ" title="Extensions FAQ"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Category:Extensions" title="Special:MyLanguage/Category:Extensions">Category:Extensions</a><span style="display:none"><a href="/wiki/Category:Extensions" title="Category:Extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:$wgExtensionFunctions" title="Special:MyLanguage/Manual:$wgExtensionFunctions">Manual:$wgExtensionFunctions</a><span style="display:none"><a href="/wiki/Manual:$wgExtensionFunctions" title="Manual:$wgExtensionFunctions"> </a></span></li></ul> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651103"> <div class="nmbox noprint mw-content-ltr"><div class="nmbox-header"><b><a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions">Extensions</a><span style="display:none"><a href="/wiki/Manual:Extensions" title="Manual:Extensions"> </a></span></b>: </div> <div class="nmbox-text mbox-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6387430"><div class="hlist"> <ul><li><a href="/wiki/Special:MyLanguage/Category:Extensions" title="Special:MyLanguage/Category:Extensions">Category</a><span style="display:none"><a href="/wiki/Category:Extensions" title="Category:Extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Category:All_extensions" title="Special:MyLanguage/Category:All extensions">All</a><span style="display:none"><a href="/wiki/Category:All_extensions" title="Category:All extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Extension_requests" title="Special:MyLanguage/Extension requests">Requests</a><span style="display:none"><a href="/wiki/Extension_requests" title="Extension requests"> </a></span></li> <li><b><a href="/wiki/Special:MyLanguage/Manual:Tag_extensions" title="Special:MyLanguage/Manual:Tag extensions">Tag extensions</a></b><span style="display:none"><a class="mw-selflink selflink"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Extensions_FAQ" title="Special:MyLanguage/Extensions FAQ">Extensions FAQ</a><span style="display:none"><a href="/wiki/Extensions_FAQ" title="Extensions FAQ"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Extensions/Installation_and_upgrade" title="Special:MyLanguage/Manual:Extensions/Installation and upgrade">Installation and upgrade</a><span style="display:none"><a href="/wiki/Manual:Extensions/Installation_and_upgrade" title="Manual:Extensions/Installation and upgrade"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Extension_registration" title="Special:MyLanguage/Manual:Extension registration">Registration</a><span style="display:none"><a href="/wiki/Manual:Extension_registration" title="Manual:Extension registration"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Category:Extension_hooks" title="Special:MyLanguage/Category:Extension hooks">List of extension hooks</a><span style="display:none"><a href="/wiki/Category:Extension_hooks" title="Category:Extension hooks"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Extension_default_namespaces" title="Special:MyLanguage/Extension default namespaces">Extension default namespaces</a><span style="display:none"><a href="/wiki/Extension_default_namespaces" title="Extension default namespaces"> </a></span></li></ul> </div></div> </div> <!-- NewPP limit report Parsed by mw‐api‐int.codfw.main‐58cc965476‐hk5q8 Cached time: 20241129001704 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] CPU time usage: 0.510 seconds Real time usage: 0.641 seconds Preprocessor visited node count: 4333/1000000 Post‐expand include size: 39269/2097152 bytes Template argument size: 17803/2097152 bytes Highest expansion depth: 20/100 Expensive parser function count: 54/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 51905/5000000 bytes Lua time usage: 0.085/10.000 seconds Lua memory usage: 1970698/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 356.113 1 -total 45.57% 162.298 34 Template:Ll 36.22% 128.994 2 Template:Nmbox 29.49% 105.021 1 Template:ExtensionTypes 23.11% 82.300 2 Template:Flatlist 22.68% 80.770 68 Template:Translatable 19.50% 69.424 35 Template:Pagelang 12.17% 43.344 2 Template:Ambox 10.58% 37.686 1 Template:Update 10.16% 36.188 1 Template:MW_1.16 --> <!-- Saved in parser cache with key mediawikiwiki:pcache:15935:|#|:idhash:canonical and timestamp 20241129001704 and revision id 6680816. Rendering was triggered because: api-parse --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?useformat=desktop&type=1x1&usesul3=0" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://www.mediawiki.org/w/index.php?title=Manual:Tag_extensions&oldid=6680816">https://www.mediawiki.org/w/index.php?title=Manual:Tag_extensions&oldid=6680816</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Special:Categories" title="Special:Categories">Categories</a>: <ul><li><a href="/wiki/Category:Outdated_pages" title="Category:Outdated pages">Outdated pages</a></li><li><a href="/wiki/Category:Pages_to_be_merged" title="Category:Pages to be merged">Pages to be merged</a></li><li><a href="/wiki/Category:Customization_techniques" title="Category:Customization techniques">Customization techniques</a></li><li><a href="/wiki/Category:MediaWiki_development" title="Category:MediaWiki development">MediaWiki development</a></li><li><a href="/wiki/Category:Parser_extensions" title="Category:Parser extensions">Parser extensions</a></li><li><a href="/wiki/Category:Sample_code" title="Category:Sample code">Sample code</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 31 July 2024, at 03:13.</li> <li id="footer-info-copyright">Text is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-ShareAlike License</a>; additional terms may apply. Text in <a class="external text" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">the Help: namespace</a> is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC0 License</a>. By using this site, you agree to the <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use">Terms of Use</a> and <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy Policy</a>.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Project:About">About mediawiki.org</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Project:General_disclaimer">Disclaimers</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/www.mediawiki.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//m.mediawiki.org/w/index.php?title=Manual:Tag_extensions&oldid=6680816&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-5ccf8d5c58-bx42r","wgBackendResponseTime":160,"wgPageParseReport":{"limitreport":{"cputime":"0.510","walltime":"0.641","ppvisitednodes":{"value":4333,"limit":1000000},"postexpandincludesize":{"value":39269,"limit":2097152},"templateargumentsize":{"value":17803,"limit":2097152},"expansiondepth":{"value":20,"limit":100},"expensivefunctioncount":{"value":54,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":51905,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 356.113 1 -total"," 45.57% 162.298 34 Template:Ll"," 36.22% 128.994 2 Template:Nmbox"," 29.49% 105.021 1 Template:ExtensionTypes"," 23.11% 82.300 2 Template:Flatlist"," 22.68% 80.770 68 Template:Translatable"," 19.50% 69.424 35 Template:Pagelang"," 12.17% 43.344 2 Template:Ambox"," 10.58% 37.686 1 Template:Update"," 10.16% 36.188 1 Template:MW_1.16"]},"scribunto":{"limitreport-timeusage":{"value":"0.085","limit":"10.000"},"limitreport-memusage":{"value":1970698,"limit":52428800}},"cachereport":{"origin":"mw-api-int.codfw.main-58cc965476-hk5q8","timestamp":"20241129001704","ttl":2592000,"transientcontent":false}}});});</script> </body> </html>