You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1.1 KiB

4 years ago
  1. {{ $inner := replaceRE "^\n" "" .Inner | string }}
  2. {{ if len .Params | eq 0 }}
  3. <pre><code>{{ $inner }}</code></pre>
  4. {{ else }}
  5. {{ if .IsNamedParams }}
  6. <pre class="
  7. {{- if .Get "lang" }}language-{{ .Get "lang" }}{{ end }}
  8. {{- if .Get "line-numbers" }} line-numbers{{ end }}
  9. {{- if .Get "command-line" }} command-line{{ end }}"
  10. {{- /* line highlight plugin */ -}}
  11. {{- if .Get "line" }} data-line="{{ .Get "line" }}"{{ end }}
  12. {{- /* line number plugin */ -}}
  13. {{- if .Get "start" }} data-start="{{ .Get "start" }}"{{ end }}
  14. {{- /* command-line plugin */ -}}
  15. {{- if .Get "user" }} data-user="{{ .Get "user" }}"{{ end }}
  16. {{- if .Get "host" }} data-host="{{ .Get "host" }}"{{ end }}
  17. {{- if .Get "prompt" }} data-prompt="{{ .Get "prompt" }}"{{ end }}
  18. {{- if .Get "output" }} data-output="{{ .Get "output" }}"{{ end }}
  19. ><code {{ if .Get "lang" }}class="language-{{ .Get "lang" }}"{{ end }}
  20. >{{ $inner }}</code></pre>
  21. {{ else }}
  22. <pre class="language-{{ .Get 0 }}">
  23. <code class="language-{{ .Get 0 }}">{{ $inner }}</code></pre>
  24. {{ end }}
  25. {{ end }}