Wikifunctions:Embedded function calls
It is now possible to embed calls to Wikifunctions in wikitext, both on this wiki and cross-wiki. You should feel free to try it out on this sandbox page, or on your user page.
There are no-doubt some bugs, and we're excited to find and fix them. That said, the below may give you a guide for your expectations.
What works now (August 2025)
You can make any calls to any Function as long as:
- it uses only input Types that are parsable from text (i.e., either their inputs are Z6/Strings or have a reading Function, like a Z13518/Natural number), or selectable from a set of options (i.e., their inputs are Z40/Boolean or other enumerations like Z16098/Gregorian calendar month), or is a Wikidata or natural language reference we support,
- it outputs a Type that is renderable into text (i.e. their output is a Z6/String or has a display Function that will turn it into one), and
- it has an approved Implementation.
Types used | Input | Result |
---|---|---|
String | {{#function:Z10018|This is a bit shouty}} |
THIS IS A BIT SHOUTY |
Boolean | {{#function:Z10730|Z41}} |
true |
Natural number | {{#function:Z11022|1234}} |
MCCXXXIV |
Floating point | {{#function:Z18428|1.2345}} km |
1.986735168 km |
Rational number | {{#function:Z19682|12/5}} |
2 |
Gregorian month | {{#function:Z13596|Z16105}} |
May |
Gregorian date | {{#function:Z20744|30 June 2020|15 April 2025}} |
1750 |
Special case: Blank value means "today's date":
|
Content error | |
Language | {{#function:Z16437|1|en}} |
one |
Special case: ZID instead of language code:
|
Content error | |
Special case: Blank value means "this page's language":
|
Content error | |
Wikidata item reference | {{#function:Z23753|Q42|en}} |
Douglas Adams |
Special case: Blank value means "Wikidata item for this page":
|
(Not applicable.) | |
Wikidata lexeme reference | {{#function:Z19248|L10958}} |
2 |
HTML (only for output) | {{#function:Z23293|2|3}} |
Content error |
Function calls are cached for all users (across all wikis), given the same inputs. If the Function call is not yet ready, a message is shown in the page ⏳ Function is being called… (wikilambda-fragment-pending
[Notes 1]). If the Function call goes wrong, it shows up in an error state and is added to the appropriate tracking category. We've planned this to work on mobile and desktop for Web readers using the standard supported skins.
Editing integration is provided with the visual and 2017 wikitext editors, and the raw wikitext should mostly work with any editor (but without any neat tools[Notes 2]). Edits to Functions used on pages that could affect the output will trigger page refreshes, including entries in Recent Changes and Watchlists (disabled by default), like Wikidata, with a structured description of what change happened (e.g. a new Implementation was connected), rendered into text in the reader's language (if available). As you create or edit a Function call inside the visual editor, you can see the result of your changes in a "preview" pane as you tweak it.
What will work soon
Setting arbitrary 'render' (display) and 'parse' (read) languages for calls
The input 1.234 in English canonically means a floating point number; in German, it means an integer. Reading and display functions take the input and display language into account, so when you embed a Wikifunctions call in a page we pass on that page's language for you. (On this wiki every page is in English (the MediaWiki default), regardless of translation status.) However, sometimes you might want to show outputs in a different language, or have an input that's original to the source, or even just a demonstration Function call that you can copy to any client wiki
This is waiting on some work upstream, and we hope to support it very soon.
![]() |
{{#function:Z10000|foo|bar|renderlang=en|parselang=en}} |
---|
Speed improvements
We're aware that using Wikifunctions can sometimes be painfully slow. We don't want that — for you, waiting for a result, or for our servers, waiting around with open connections to serve pages. It's expensive in peoples' time and sapping of confidence in the system, and we will do better.
We're working on this as part of this Quarter's work, and expect to ship the first of these improvements over the next month or so.
Calling Wikifunctions from within a template or parser function
For now, Wikifunctions calls are only supported at the "top level" of a page — i.e., in the wikitext of the page itself, and not in parameters passed to templates or parser functions on the page. Using the Wikifunctions parser function as a parameter will generally not work, or provide surprising results. Note that if the exact call has already been used, it will happen to work, but it should not be relied upon. This is due to the new changes to MediaWiki, and the new feature will expand over time.
We're working with upstream on various issues, and this parts of this may be remedied in the next few months; we will keep you updated.
![]() |
{{1x|{{#function:Z11022|1234}}}} -> MCCXXXIV (but only because this exact call is already on the page) |
---|---|
![]() |
{{1x|{{#function:Z11022|321}}}} |
![]() |
{{#ifeq:{{#function:Z11022|4321}}|MMMMCCCXXI|same|different}} |
Use on more wikis
Right now, we've enabled this feature here on Wikifunctions.org itself, and on the Dagbani Wikipedia and most Wiktionary communities. We're really keen to hear feedback here (on the talk page or wherever) on what works or doesn't, what's expected or surprising, and where we frustrate or delight you.
We're working on this as a big part of our work, and expect to ship it to most other Wiktionaries, and some other wikis, over the next few months. Wider deployment relies on major work upstream to migrate wikis off the legacy parser, as well as performance and scaling work at our end, and so we are limited in the places to which we can deploy the feature right now.
What won't work for a while
Use on very big wikis
Due to a combination of the speed and legacy parser issues above, and nervousness about scalability, we do not plan to deploy the Wikifunctions client mode to any "large" Wikimedia wikis soon. We'll keep you updated as we learn more.
Provenance in output (citations, etc.)
A huge part of the trustworthiness of the Wikimedia communities' outputs over the last quarter-century has been based on provenance information being displayed prominently and reliably next to claims. We definitely want to support this for the outputs of Wikifunctions calls, but it has some huge design, community, product, and engineering concerns that we (and the whole Wikimedia movement!) will need to solve first, or at least agree an experimental way forward. We do not expect this to happen soon, sadly, but we're strongly focussed on it as a key need for people both to have confidence in using Wikifunctions, but also to know where to go to fix issues or expand content when they see something wrong in Wikifunctions usage.
Taking over article pages and search results on wikis
A key hoped-for outcome of the long-term vision for Abstract Wikipedia is to provide short articles and snippets made up entirely of Wikifunctions calls using Wikidata inputs, shown alongside local articles. We're very interested in this and plan to deliver it as the main part of the Abstract Wikipedia vision, but we don't want to promise a timeline. Soon, we'll be starting a wider set of conversations about what this kind of "Abstract Content" would be in terms of where it would live, how it would be edited and maintained and by whom, and how it might be presented.
User-interactive "dynamic" calls
Several people have requested a means by which Functions can be embedded into articles as interactive elements, where readers are prompted to set inputs and run the Function to get the output, which might be useful in teaching e.g. mathematical concepts. There are already some interesting gadget-bourne systems in some communities, and it's clear that it's potentially very exciting, but it has a number of usability and scalability concerns, and it's not a focus of the team right now.
Non-text output
A number of people have asked if it will be possible to have Functions output non-text items, like bar charts and sheet music (using SVG or other technologies). We think this is a neat idea, but it's not a focus of the team for the medium term.
What will never work
Use with the legacy parser
Major structural changes had to be made MediaWiki to support Wikifunctions calls being embedded into pages. The core of MediaWiki, the parser which turns wikitext into HTML, is 13 years into being replaced, and is in the final stretches. Because of this, the changes to support us are available only in the modern page system ("Parsoid"). If the site's configuration or your preferences force the page to be in non-Parsoid mode, it will instead show the raw wikitext of the function call; this currently includes Test Wikipedia, so please do not try out the feature there for now, and be aware that there's likely a long tail of tools that will need to be updated.
Wikitext output
As part of Wikifunctions calls only being able to be used in the modern page system, this means that you will not be able to output wikitext fragments, only plain text and (later) valid, balanced HTML. This means your Function will be able to output <em>l'Étranger</em> is…
but not ''l'Étranger'' is…
.[Notes 3]
Unbalanced output
As with the above, we cannot provide content that affects content outside of its part of the page — so you can't use a Function call to open or close a table or box, or format a table row (rather than provide the entire table).
Notes
- ↑ As always, please do not over-write this message locally, but suggest improvements in Phabricator tasks so we can share them for all communities and languages.
- ↑ For example, in the 2010 wikitext editor it won't preview using the new parser, so you only see the wikitext you inputted, not the result until after you've published.
- ↑ There are other restrictions / benefits as well.