Template:Encodefirst/doc

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by imported>PrimeHunter at 13:46, 14 July 2025 (Examples: {{la}} was fixed by using this template so change example to {{Article talk links}} which is still broken and explain the difference. Add a test link for the broken example without disrupting this page with broken code). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This template replaces the first character of the argument with its HTML entity if it is one of four wiki markup characters : ; * #. This can sometimes fix the issue at Help:Template#Problems and workarounds where a character may be processed as though it were at the beginning of a line.

{{Encodefirst|<string>}}

Examples

[edit source]

The output looks like the input whether a character is replaced or not.

{{Encodefirst|*Lisp}} produces: *Lisp

But the output will behave differently from the input in some situations where it is processed. For example, {{Article talk links}} fails as of 2025 if its argument starts with *. Some other templates like {{Article links}} have been modified (diff) to automatically use {{encodefirst}} so the caller doesn't have to do it.

{{Article talk links|*Lisp}} causes the asterisk to be processed as list markup and produces broken display (test).

{{Article talk links|{{Encodefirst|*Lisp}}}} works correctly:

Talk:*Lisp (edit | subject | history | links | watch | logs)