Template:Viewer/Github/Code

Template page

Example / Selftest


class OSW(BaseModel):
    """Bundles core functionalities of OpenSemanticWorld (OSW)"""

    uuid: str = "2ea5b605-c91f-4e5a-9559-3dff79fdd4a5"
    _protected_keywords = (
        "_osl_template",
        "_osl_footer",
    )  # private properties included in model export

    class Config:
        arbitrary_types_allowed = True  # neccessary to allow e.g. np.array as type

    site: WtSite

(Source Code from Github)

Embeds a source code block from github with syntax highlighting

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Github (perma)linkurl

When using line numbers (in the link or as parameter) use the permalink!

Example
https://github.com/OpenSemanticLab/mediawiki-extensions-OpenSemanticLab/blob/ca3558f07d1eb90d504f8304ae0a93d8a3c2a85c/includes/OpenSemanticLab.php#L3-L12
URLrequired
Start linestart_line

Start line of a sub-section of the file. Can also be specified in the link as #L3

Example
3
Numberoptional
End lineend_line

Start line of a sub-section of the file. Can also be specified in the link as #L3-L12

Example
12
Numberoptional
Show line numbersshow_line_numbers

If selected, line numbers are displayed

Auto value
0
Booleanoptional
Languagelang

Language for the syntax highlighting. Auto-detected from the file suffix (e. g. ".py") for some languages, defaults to "text".

Example
python
Stringoptional
Highlighted lineshighlight

List of lines or line ranges to highlight. Line numbers are absolute and must be between start and end line of a block selection. Not supported with rendered markdown.

Example
5,7,9-10
Stringsuggested
Render markdownrender_markdown

If set, Markdown files (".md") are rendered instead of displaying the source text

Auto value
1
Booleanoptional
UUID (auto-generated, should not be changed)uuid

no description

Auto value
{{subst:UUID}}
Stringrequired


Cookies help us deliver our services. By using our services, you agree to our use of cookies.