Help:Formatting: Difference between revisions

Jump to navigation Jump to search
→‎Links: -Interwiki links - Probably a bad practice; +Link templates - Should be encouraged
(→‎Differentiating good and bad code snippets: Examples of bad code can be highlighted using the css attribute style="background: #ffdddd;")
(→‎Links: -Interwiki links - Probably a bad practice; +Link templates - Should be encouraged)
Line 372: Line 372:
|}
|}


=== Interwiki links ===
=== Links to external sites ===
''Interwiki links'', links to other wikis and a few other web sites, in a shorter way than regular external links, are marked up in a similar way to ordinary wiki links with the addition of an  lowercase interwiki prefix and a colon ('''<nowiki>[[</nowiki>''prefix'':''Article''<nowiki>]]</nowiki>''').  There are many, many interwiki prefixes.  For a complete list see [[Special:Interwiki]].
''External links'', links to other web sites, are marked up with single square brackets ('''<nowiki>[ ]</nowiki>''') on each side.
{| class="wikitable" width="100%"
{| class="wikitable" width="100%"
! Description
! Description
Line 379: Line 379:
! width="30%" | What you get
! width="30%" | What you get
|-
|-
| Interwiki link
| External link
|
|
  <nowiki>[[wikipedia:FlightGear]]</nowiki>
  <nowiki>http://www.mediawiki.org/wiki/Help:Links</nowiki>
| [[wikipedia:FlightGear]]
| http://www.mediawiki.org/wiki/Help:Links
|-
|-
| Piped links can be used as well
| External link without label
|
|
  <nowiki>[[mediawikiwiki:Help:Links|Link]] help at MediaWiki</nowiki>
  <nowiki>[http://www.mediawiki.org/wiki/Help:Links]</nowiki>
| [[mediawikiwiki:Help:Links|Link]] help at MediaWiki
| [http://www.mediawiki.org/wiki/Help:Links]
|-
|-
| Piped link with no alternative link title will only show the article name
| External link with label.  A blank space ( ) separates the URL from the label.
|
|
  <nowiki>[[meta:Help:Page name|]] on Wikimedia Meta-Wiki</nowiki>
  <pre style="white-space: pre-wrap;">[http://www.mediawiki.org/wiki/Help:Links MediaWiki link help]</pre>
| [[meta:Help:Page name|Help:Page name]] on Wikimedia Meta-Wiki
| [http://www.mediawiki.org/wiki/Help:Links MediaWiki link help]
|}
|}


=== Links to external sites ===
=== Link templates ===
''External links'', links to other web sites, are marked up with single square brackets ('''<nowiki>[ ]</nowiki>''') on each side.
''Link templates'' can and should be used when external web sites are often linked to and/or when the URLs are complicated.  This could for example be code repositories, the issue tracker etc.  Using them will help reducing typing, reducing errors and most of all lessen the amount of maintenance edits needed if for example a repository changes hosting.
 
The link templates can be found in [[:Category:Link templates]].  Many of them have documentation on the template pages. Here follows some commonly used templates.
 
{| class="wikitable" width="100%"
{| class="wikitable" width="100%"
! Description
! Description
Line 402: Line 405:
! width="30%" | What you get
! width="30%" | What you get
|-
|-
| External link
| Linking to Wikipedia with {{tl|wikipedia}}
|
|
  <nowiki>http://www.mediawiki.org/wiki/Help:Links</nowiki>
  <nowiki>{{Wikipedia|FlightGear}}</nowiki>
| http://www.mediawiki.org/wiki/Help:Links
| {{Wikipedia|FlightGear}}
|-
|-
| External link without label
| Linking to a issue tracker ticket with {{tl|ticket}}
|
|
  <nowiki>[http://www.mediawiki.org/wiki/Help:Links]</nowiki>
  <nowiki>{{ticket|202}}</nowiki>
| [http://www.mediawiki.org/wiki/Help:Links]
| {{ticket|202}}
|-
|-
| External link with label. A blank space ( ) separates the URL from the label.
| Linking to a repository with {{tl|repo link}}
|
<nowiki>{{repo link
| site = sf
| rev = 280
| branch = branches/release-3.4.0
| text = FG 3.4 add-on aircraft
}}</nowiki>
|
|
<pre style="white-space: pre-wrap;">[http://www.mediawiki.org/wiki/Help:Links MediaWiki link help]</pre>
{{repo link
| [http://www.mediawiki.org/wiki/Help:Links MediaWiki link help]
| site = sf
| rev = 280
| branch = branches/release-3.4.0
| text = FG 3.4 add-on aircraft
}}
|}
|}
For more information on templates, see [[Help:Templates]].


=== Permalinks and links to diffs ===
=== Permalinks and links to diffs ===

Navigation menu