Help:Pre-save transform
Note: When you edit this page, you agree to release your contribution under the CC0. See Public Domain Help Pages for more info. |
When you finish editing a page on MediaWiki and click on the Publish changes
button, the wikitext you enter may be automatically modified before it is saved.
This process is called a pre-save transform (PST), and it is visible when you click on the Show changes
button.
The visual rendering of the PST is shown when you click on the Show preview
button.
The modified wikitext won't appear in the edit box immediately. To see the changes in the wikitext, you need to save and then press "Edit" again.
Examples
The instances in which wikitext is automatically transformed include:
- Substitution
- Tildes:
~~~
creates a signature without including the time or date.~~~~~
provides the time and date information, such as08:56, 2 July 2024 (UTC)
~~~~
creates a complete signature, combining~~~
and~~~~~
- Pipe trick
When you add this code to a template, please make sure it doesn't convert wikitext too soon, like when saving the template. One way to do this is by enclosing the split code within the template's parameters. For example:
{{{{{|safesubst:}}}CURRENTTIME}}
{{{|~~}}}~~
<nowiki>~~</nowiki>~~
[[abc (def)|{{{|}}}]]
The last example isn't very helpful, it's just there to show how it's similar to the other three examples.
Another way is using the <includeonly />
tags.
You can also use a template parameter to decide when to apply the conversion during template substitution.
For example, {{{{{subst1|}}}CURRENTTIME}}
converts if the subst1
parameter equals subst:
or safesubst:
, otherwise, it doesn't if the parameter is empty or undefined.
Limits
Automatic conversions of wikitext won't happen in <ref>...</ref>
and <gallery>...</gallery>
tags.[1]