Template:Codesample

From Wikitech
Jump to navigation Jump to search
Template documentation

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Codesample

<syntaxhighlight> with fancy colors and an optional title

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Codecode 1

Code sample to render

Stringrequired
Programming languagelang

Name of lexer to use for highlighting

Default
text
Example
shell-session
Stringsuggested
Titlename

Title (name) of this code sample. Often a filename

Stringsuggested
Highlighted lineshighlight

Line(s) in example to highlight. Comma separated list of line numbers

Stringoptional
Show line numbersline

Enable line numbers for sample

Booleanoptional
Starting line numberstart

Starting line number when line numbers are shown. Note: Does not effect line numbers used for highlights.

Default
1
Numberoptional
Color schemescheme

Color scheme to use. "dark" and "light" will apply solarized color schemes. Anything else will use syntaxhighlight extension defaults.

Stringoptional
echo "hello world!"
echo "hello world!"
$ echo "hello world!"
{{Codesample}}
ingress.yaml
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/permanent-redirect: https://bar.toolforge.org/$1$is_args$args
spec:
  rules:
    - host: foo.toolforge.org
      http:
        paths:
          - backend:
              serviceName: unused
              servicePort: 8000
            path: /(.*)
metadata
name: foo-redirect
  namespace: tool-foo
  labels:
    name: foo-redirect
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/permanent-redirect: https://bar.toolforge.org/$1$is_args$args