Vorlage:Codesample

Aus d.hack
Version vom 30. April 2024, 07:37 Uhr von AnthBrun (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „{{Documentation subpage}} {{Uses TemplateStyles|Template:Codesample/style.css|Template:Codesample/dark.css|Template:Codesample/light.css|Template:Codesample/borland.css}} <templatedata> { "params": { "code": { "aliases": [ "1" ], "label": "Code", "description": "Code sample to render", "type": "string", "required": true }, "lang": { "label": "Programming language", "description": "Name of lexer to use for highlighting",…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Vorlage:Documentation subpage Vorlage:Uses TemplateStyles <templatedata> { "params": { "code": { "aliases": [ "1" ], "label": "Code", "description": "Code sample to render", "type": "string", "required": true }, "lang": { "label": "Programming language", "description": "Name of lexer to use for highlighting", "example": "shell-session", "type": "string", "default": "text", "suggested": true }, "name": { "label": "Title", "description": "Title (name) of this code sample. Often a filename", "type": "string", "suggested": true }, "highlight": { "label": "Highlighted lines", "description": "Line(s) in example to highlight. Comma separated list of line numbers", "type": "string" }, "line": { "label": "Show line numbers", "description": "Enable line numbers for sample", "type": "boolean" }, "start": { "label": "Starting line number", "description": "Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.", "type": "number", "default": "1" }, "scheme": { "label": "Color scheme", "description": "Color scheme to use. \"dark\" and \"light\" will apply solarized color schemes. Anything else will use syntaxhighlight extension defaults.", "type": "string", "default": "dark" } }, "description": "This template augments a <syntaxhighlight> block with fancy colors and an optional title", "paramOrder": [ "name", "lang", "code", "highlight", "line", "start", "scheme" ], "format": "block" } </templatedata>

Examples

{{Codesample |echo "hello world!"}} Vorlage:Documentation subpage

Vorlage:Uses TemplateStyles <templatedata> { "params": { "code": { "aliases": [ "1" ], "label": "Code", "description": "Code sample to render", "type": "string", "required": true }, "lang": { "label": "Programming language", "description": "Name of lexer to use for highlighting", "example": "shell-session", "type": "string", "default": "text", "suggested": true }, "name": { "label": "Title", "description": "Title (name) of this code sample. Often a filename", "type": "string", "suggested": true }, "highlight": { "label": "Highlighted lines", "description": "Line(s) in example to highlight. Comma separated list of line numbers", "type": "string" }, "line": { "label": "Show line numbers", "description": "Enable line numbers for sample", "type": "boolean" }, "start": { "label": "Starting line number", "description": "Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.", "type": "number", "default": "1" }, "scheme": { "label": "Color scheme", "description": "Color scheme to use. \"dark\" and \"light\" will apply solarized color schemes. Anything else will use syntaxhighlight extension defaults.", "type": "string", "default": "dark" } }, "description": "This template augments a <syntaxhighlight> block with fancy colors and an optional title", "paramOrder": [ "name", "lang", "code", "highlight", "line", "start", "scheme" ], "format": "block" } </templatedata>

Examples

{{Codesample |echo "hello world!"}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |echo "hello world!" |lang=text |scheme=light}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |$ echo "hello world!" |lang=shell-session |scheme=dark}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |code=<nowiki>{{Codesample}}</nowiki> |lang=wikitext}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=ingress.yaml |lang=yaml |scheme=dark |line=1 |highlight=5,8 |code=
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=metadata |lang=yaml |scheme=light |line=1 |start=5 |highlight=1,4 |code=
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample

Adding a new color scheme

The scheme=... parameter will load a css sub-page to add styles matching the Pygments markup definitions. The easiest way to introduce a new scheme is to export it from Pygments itself: pygmentize -f html -S $style -a .wt-codesample-${style}.

See also

{{Codesample |echo "hello world!" |lang=text |scheme=light}} Vorlage:Documentation subpage

Vorlage:Uses TemplateStyles <templatedata> { "params": { "code": { "aliases": [ "1" ], "label": "Code", "description": "Code sample to render", "type": "string", "required": true }, "lang": { "label": "Programming language", "description": "Name of lexer to use for highlighting", "example": "shell-session", "type": "string", "default": "text", "suggested": true }, "name": { "label": "Title", "description": "Title (name) of this code sample. Often a filename", "type": "string", "suggested": true }, "highlight": { "label": "Highlighted lines", "description": "Line(s) in example to highlight. Comma separated list of line numbers", "type": "string" }, "line": { "label": "Show line numbers", "description": "Enable line numbers for sample", "type": "boolean" }, "start": { "label": "Starting line number", "description": "Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.", "type": "number", "default": "1" }, "scheme": { "label": "Color scheme", "description": "Color scheme to use. \"dark\" and \"light\" will apply solarized color schemes. Anything else will use syntaxhighlight extension defaults.", "type": "string", "default": "dark" } }, "description": "This template augments a <syntaxhighlight> block with fancy colors and an optional title", "paramOrder": [ "name", "lang", "code", "highlight", "line", "start", "scheme" ], "format": "block" } </templatedata>

Examples

{{Codesample |echo "hello world!"}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |echo "hello world!" |lang=text |scheme=light}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |$ echo "hello world!" |lang=shell-session |scheme=dark}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |code=<nowiki>{{Codesample}}</nowiki> |lang=wikitext}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=ingress.yaml |lang=yaml |scheme=dark |line=1 |highlight=5,8 |code=
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=metadata |lang=yaml |scheme=light |line=1 |start=5 |highlight=1,4 |code=
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample

Adding a new color scheme

The scheme=... parameter will load a css sub-page to add styles matching the Pygments markup definitions. The easiest way to introduce a new scheme is to export it from Pygments itself: pygmentize -f html -S $style -a .wt-codesample-${style}.

See also

{{Codesample |$ echo "hello world!" |lang=shell-session |scheme=dark}} Vorlage:Documentation subpage

Vorlage:Uses TemplateStyles <templatedata> { "params": { "code": { "aliases": [ "1" ], "label": "Code", "description": "Code sample to render", "type": "string", "required": true }, "lang": { "label": "Programming language", "description": "Name of lexer to use for highlighting", "example": "shell-session", "type": "string", "default": "text", "suggested": true }, "name": { "label": "Title", "description": "Title (name) of this code sample. Often a filename", "type": "string", "suggested": true }, "highlight": { "label": "Highlighted lines", "description": "Line(s) in example to highlight. Comma separated list of line numbers", "type": "string" }, "line": { "label": "Show line numbers", "description": "Enable line numbers for sample", "type": "boolean" }, "start": { "label": "Starting line number", "description": "Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.", "type": "number", "default": "1" }, "scheme": { "label": "Color scheme", "description": "Color scheme to use. \"dark\" and \"light\" will apply solarized color schemes. Anything else will use syntaxhighlight extension defaults.", "type": "string", "default": "dark" } }, "description": "This template augments a <syntaxhighlight> block with fancy colors and an optional title", "paramOrder": [ "name", "lang", "code", "highlight", "line", "start", "scheme" ], "format": "block" } </templatedata>

Examples

{{Codesample |echo "hello world!"}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |echo "hello world!" |lang=text |scheme=light}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |$ echo "hello world!" |lang=shell-session |scheme=dark}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |code=<nowiki>{{Codesample}}</nowiki> |lang=wikitext}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=ingress.yaml |lang=yaml |scheme=dark |line=1 |highlight=5,8 |code=
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=metadata |lang=yaml |scheme=light |line=1 |start=5 |highlight=1,4 |code=
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample

Adding a new color scheme

The scheme=... parameter will load a css sub-page to add styles matching the Pygments markup definitions. The easiest way to introduce a new scheme is to export it from Pygments itself: pygmentize -f html -S $style -a .wt-codesample-${style}.

See also

{{Codesample |code=<nowiki>{{Codesample}}</nowiki> |lang=wikitext}} Vorlage:Documentation subpage

Vorlage:Uses TemplateStyles <templatedata> { "params": { "code": { "aliases": [ "1" ], "label": "Code", "description": "Code sample to render", "type": "string", "required": true }, "lang": { "label": "Programming language", "description": "Name of lexer to use for highlighting", "example": "shell-session", "type": "string", "default": "text", "suggested": true }, "name": { "label": "Title", "description": "Title (name) of this code sample. Often a filename", "type": "string", "suggested": true }, "highlight": { "label": "Highlighted lines", "description": "Line(s) in example to highlight. Comma separated list of line numbers", "type": "string" }, "line": { "label": "Show line numbers", "description": "Enable line numbers for sample", "type": "boolean" }, "start": { "label": "Starting line number", "description": "Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.", "type": "number", "default": "1" }, "scheme": { "label": "Color scheme", "description": "Color scheme to use. \"dark\" and \"light\" will apply solarized color schemes. Anything else will use syntaxhighlight extension defaults.", "type": "string", "default": "dark" } }, "description": "This template augments a <syntaxhighlight> block with fancy colors and an optional title", "paramOrder": [ "name", "lang", "code", "highlight", "line", "start", "scheme" ], "format": "block" } </templatedata>

Examples

{{Codesample |echo "hello world!"}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |echo "hello world!" |lang=text |scheme=light}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |$ echo "hello world!" |lang=shell-session |scheme=dark}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |code=<nowiki>{{Codesample}}</nowiki> |lang=wikitext}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=ingress.yaml |lang=yaml |scheme=dark |line=1 |highlight=5,8 |code=
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=metadata |lang=yaml |scheme=light |line=1 |start=5 |highlight=1,4 |code=
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample

Adding a new color scheme

The scheme=... parameter will load a css sub-page to add styles matching the Pygments markup definitions. The easiest way to introduce a new scheme is to export it from Pygments itself: pygmentize -f html -S $style -a .wt-codesample-${style}.

See also

{{Codesample |name=ingress.yaml |lang=yaml |scheme=dark |line=1 |highlight=5,8 |code=
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlage:Documentation subpage

Vorlage:Uses TemplateStyles <templatedata> { "params": { "code": { "aliases": [ "1" ], "label": "Code", "description": "Code sample to render", "type": "string", "required": true }, "lang": { "label": "Programming language", "description": "Name of lexer to use for highlighting", "example": "shell-session", "type": "string", "default": "text", "suggested": true }, "name": { "label": "Title", "description": "Title (name) of this code sample. Often a filename", "type": "string", "suggested": true }, "highlight": { "label": "Highlighted lines", "description": "Line(s) in example to highlight. Comma separated list of line numbers", "type": "string" }, "line": { "label": "Show line numbers", "description": "Enable line numbers for sample", "type": "boolean" }, "start": { "label": "Starting line number", "description": "Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.", "type": "number", "default": "1" }, "scheme": { "label": "Color scheme", "description": "Color scheme to use. \"dark\" and \"light\" will apply solarized color schemes. Anything else will use syntaxhighlight extension defaults.", "type": "string", "default": "dark" } }, "description": "This template augments a <syntaxhighlight> block with fancy colors and an optional title", "paramOrder": [ "name", "lang", "code", "highlight", "line", "start", "scheme" ], "format": "block" } </templatedata>

Examples

{{Codesample |echo "hello world!"}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |echo "hello world!" |lang=text |scheme=light}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |$ echo "hello world!" |lang=shell-session |scheme=dark}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |code=<nowiki>{{Codesample}}</nowiki> |lang=wikitext}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=ingress.yaml |lang=yaml |scheme=dark |line=1 |highlight=5,8 |code=
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=metadata |lang=yaml |scheme=light |line=1 |start=5 |highlight=1,4 |code=
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample

Adding a new color scheme

The scheme=... parameter will load a css sub-page to add styles matching the Pygments markup definitions. The easiest way to introduce a new scheme is to export it from Pygments itself: pygmentize -f html -S $style -a .wt-codesample-${style}.

See also

{{Codesample |name=metadata |lang=yaml |scheme=light |line=1 |start=5 |highlight=1,4 |code=
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlage:Documentation subpage

Vorlage:Uses TemplateStyles <templatedata> { "params": { "code": { "aliases": [ "1" ], "label": "Code", "description": "Code sample to render", "type": "string", "required": true }, "lang": { "label": "Programming language", "description": "Name of lexer to use for highlighting", "example": "shell-session", "type": "string", "default": "text", "suggested": true }, "name": { "label": "Title", "description": "Title (name) of this code sample. Often a filename", "type": "string", "suggested": true }, "highlight": { "label": "Highlighted lines", "description": "Line(s) in example to highlight. Comma separated list of line numbers", "type": "string" }, "line": { "label": "Show line numbers", "description": "Enable line numbers for sample", "type": "boolean" }, "start": { "label": "Starting line number", "description": "Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.", "type": "number", "default": "1" }, "scheme": { "label": "Color scheme", "description": "Color scheme to use. \"dark\" and \"light\" will apply solarized color schemes. Anything else will use syntaxhighlight extension defaults.", "type": "string", "default": "dark" } }, "description": "This template augments a <syntaxhighlight> block with fancy colors and an optional title", "paramOrder": [ "name", "lang", "code", "highlight", "line", "start", "scheme" ], "format": "block" } </templatedata>

Examples

{{Codesample |echo "hello world!"}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |echo "hello world!" |lang=text |scheme=light}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |$ echo "hello world!" |lang=shell-session |scheme=dark}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |code=<nowiki>{{Codesample}}</nowiki> |lang=wikitext}} Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=ingress.yaml |lang=yaml |scheme=dark |line=1 |highlight=5,8 |code=
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample
{{Codesample |name=metadata |lang=yaml |scheme=light |line=1 |start=5 |highlight=1,4 |code=
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
}}
Vorlagenschleife entdeckt: Vorlage:Codesample

Adding a new color scheme

The scheme=... parameter will load a css sub-page to add styles matching the Pygments markup definitions. The easiest way to introduce a new scheme is to export it from Pygments itself: pygmentize -f html -S $style -a .wt-codesample-${style}.

See also

Adding a new color scheme

The scheme=... parameter will load a css sub-page to add styles matching the Pygments markup definitions. The easiest way to introduce a new scheme is to export it from Pygments itself: pygmentize -f html -S $style -a .wt-codesample-${style}.

See also