テンプレート:Codesample

提供:Minecraft Japan Wiki
ナビゲーションに移動 検索に移動
[閲覧 | 編集 | 履歴 | キャッシュ破棄]ドキュメント

TemplateData[ソースを編集]

<syntaxhighlight> with fancy colors and an optional title

テンプレートパラメーター[テンプレートデータを編集]

このテンプレートは、パラメーターを複数行に分けて記述することが推奨されています。

パラメーター説明状態
Titlename

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

文字列推奨
Programming languagelang

Name of lexer to use for highlighting

既定
text
shell-session
文字列推奨
Codecode 1

Code sample to render

文字列必須
Highlighted lineshighlight

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

文字列省略可能
Show line numbersline

Enable line numbers for sample

ブール値省略可能
Starting line numberstart

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

既定
1
数値省略可能
Color schemescheme

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

既定
dark
文字列省略可能

Examples[ソースを編集]

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

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}.

[閲覧 | 編集 | 履歴 | キャッシュ破棄]上記の記事は次のページから転記しています: テンプレート:Codesample/doc.
Cookieは私達のサービスを提供するのに役立ちます。このサービスを使用することにより、お客様はCookieの使用に同意するものとします。