Template:Github

From mediawiki.org

example/file.php

Template documentation


This template provides an alternative to {{Git file }} for linking to source code.

This uses the GitHub mirror instead of Diffusion the Gitblit server at git.wikimedia.org (WMF deprecated gitblit and git.wikimedia.org in 2015). Editors may find GitHub's interface more user-friendly, faster responding, visually appealing, or otherwise preferable. Compare:

  • diffusion link ← {{git file|file=index.php|text=diffusion link|line=39|branch=REL1_25}}
  • github link ← {{github|index.php|github link|line=39|branch=REL1_25}}

Usage[edit]

Basic

 {{github |file=composer.json }}
 {{github |repo=mediawiki-extensions-Flow |file=composer.json }}

produces:

composer.json
composer.json

Action

{{github |repo=mediawiki-extensions-EventLogging 
 |file=server/bin/eventlogging-devserver
 |text=development server | action=raw }}

produces:

development server

Line number

{{github |file=tests/phpunit/includes/MessageTest.php |line=152 }}

produces:

tests/phpunit/includes/MessageTest.php

A convenient way of linking to source code on GitHub.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
GitHub owner nameowner

The GitHub username of the user or organization that owns the repository

Default
wikimedia
Stringoptional
GitHub repository namerepo

Full repository name (e.g. "mediawiki" or "mediawiki-extensions-EventLogging"). Must not include any ".git" suffix.

Default
mediawiki
Stringoptional
GitHub repository actionaction

A GitHub repo action. One of "blob", "raw", "blame", "commits", or "tree"

Default
blob
Stringoptional
GitHub branchbranch

Represents the git branch of the repository to view

Default
master
Example
REL1_34
Stringoptional
Absolute file pathfile

Represents the full, absolute path to the file

Stringrequired
Line numberline

Represents the line number to directly link to

Numberoptional
Link labeltext

Custom label for the link created by this template.

Default
The file path
Stringoptional

See also[edit]