3,860
edits
(-) |
(-) |
||
Line 12: | Line 12: | ||
===Syntax=== | ===Syntax=== | ||
The template's syntax is | The template's syntax is | ||
* {{tlc| | * {{tlc|User:Lakrits/templatesandbox|anchor1 |anchor2 |anchor3 |…|anchor10 }} | ||
;<big>Example anchors</big> | ;<big>Example anchors</big> | ||
Line 30: | Line 30: | ||
;<big>Usage</big> | ;<big>Usage</big> | ||
* {{tlc| | * {{tlc|User:Lakrits/templatesandbox|<big>'''1'''</big>}} | ||
===Optional parameters=== | ===Optional parameters=== | ||
Line 42: | Line 42: | ||
;<big>Usage</big> | ;<big>Usage</big> | ||
* {{tlc| | * {{tlc|User:Lakrits/templatesandbox|1|<big>'''2'''</big>|<big>'''3'''</big>|…|<big>'''10'''</big>}} | ||
===Limitations=== | ===Limitations=== | ||
Line 81: | Line 81: | ||
;<big>Section titles</big> | ;<big>Section titles</big> | ||
* If the template is added to a section title then the code will appear in the edit summary window when that section is edited, as in "{{code|<nowiki>/* {{ | * If the template is added to a section title then the code will appear in the edit summary window when that section is edited, as in "{{code|<nowiki>/* {{User:Lakrits/templatesandbox|Issues}}Limitations */ New issue</nowiki>}}". Also, when the section is saved, browsers may not return to the section. Consider using {{code|<nowiki><span id="…"></span></nowiki>}} directly, rather than using the anchor template, when in a section title. | ||
;<big>Treat as case-sensitive</big> | ;<big>Treat as case-sensitive</big> | ||
Line 96: | Line 96: | ||
|- | |- | ||
| Basic use | | Basic use | ||
| {{tlc| | | {{tlc|User:Lakrits/templatesandbox|Example1}} {{code|Target 1}} | ||
| {{ | | {{User:Lakrits/templatesandbox|Example1}} Target 1 | ||
| Can be linked to with {{code|<nowiki>[[#Example1|…]]</nowiki>}} from within the same article, or with {{code|<nowiki>[[Article name#Example1|…]]</nowiki>}} from other articles and from redirects. | | Can be linked to with {{code|<nowiki>[[#Example1|…]]</nowiki>}} from within the same article, or with {{code|<nowiki>[[Article name#Example1|…]]</nowiki>}} from other articles and from redirects. | ||
|- | |- | ||
| Multiple anchors | | Multiple anchors | ||
| {{tlc| | | {{tlc|User:Lakrits/templatesandbox|Example2|Example3|Example4}} {{code|Target 2}} | ||
| {{ | | {{User:Lakrits/templatesandbox|Example2|Example3|Example4}} Target 2 | ||
| Creates three anchors for the same target location that then can be linked to with {{code|<nowiki>[[#Example2|…]]</nowiki>}}, {{code|<nowiki>[[#Example3|…]]</nowiki>}}, or {{code|<nowiki>[[#Example4|…]]</nowiki>}}, respectively. | | Creates three anchors for the same target location that then can be linked to with {{code|<nowiki>[[#Example2|…]]</nowiki>}}, {{code|<nowiki>[[#Example3|…]]</nowiki>}}, or {{code|<nowiki>[[#Example4|…]]</nowiki>}}, respectively. | ||
|- | |- | ||
| Section title <br>(template) | | Section title <br>(template) | ||
| {{code|<nowiki>==</nowiki> }}{{tlc| | | {{code|<nowiki>==</nowiki> }}{{tlc|User:Lakrits/templatesandbox|Example5}}{{code| Section title A <nowiki>==</nowiki>}} | ||
| {{ | | {{User:Lakrits/templatesandbox|Example5}} <span style="font: 21px Fira Sans; text-decoration: underline;">Section title A</span> | ||
| Anchors can be more suitable for inter-article linking than section titles are. In this case, links in the format {{code|<nowiki>[[Article name#Example5]]</nowiki>}} would remain valid even if the section itself was renamed. (Note that the anchor is placed ''before'' the section name; otherwise browsers may hide the section title from view.) | | Anchors can be more suitable for inter-article linking than section titles are. In this case, links in the format {{code|<nowiki>[[Article name#Example5]]</nowiki>}} would remain valid even if the section itself was renamed. (Note that the anchor is placed ''before'' the section name; otherwise browsers may hide the section title from view.) | ||
|- | |- | ||
| Section title <br>(HTML) | | Section title <br>(HTML) | ||
| {{code|<nowiki>==</nowiki> <nowiki><span id="Example6"></span></nowiki> Section title B <nowiki>==</nowiki>}} | | {{code|<nowiki>==</nowiki> <nowiki><span id="Example6"></span></nowiki> Section title B <nowiki>==</nowiki>}} | ||
| {{ | | {{User:Lakrits/templatesandbox|Custom anchor name}} <span id="Example6"></span><span style="font: 21px Fira Sans; text-decoration: underline;">Section title B</span> | ||
| As noted under [[#Limitations|Limitations]] above, it may be preferable to use direct HTML rather than the template within section titles. | | As noted under [[#Limitations|Limitations]] above, it may be preferable to use direct HTML rather than the template within section titles. | ||
|} | |} | ||
Line 121: | Line 121: | ||
! Case !! What you write !! What you see | ! Case !! What you write !! What you see | ||
|- | |- | ||
| > 10 anchors || {{tlc| | | > 10 anchors || {{tlc|User:Lakrits/templatesandbox|1|2|3|4|5|6|7|8|9|10|11}} || {{User:Lakrits/templatesandbox|1|2|3|4|5|6|7|8|9|10|11}} | ||
|- | |- | ||
| No parameter || {{tlc| | | No parameter || {{tlc|User:Lakrits/templatesandbox}} || {{User:Lakrits/templatesandbox}} | ||
|} | |} | ||
edits