0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

shortcodes/example.html: allow specifying the highlighting language

This commit is contained in:
XhmikosR 2020-05-02 18:38:25 +03:00
parent 9a5b4766ae
commit 08742abda3

View File

@ -8,6 +8,7 @@
show_markup: if the markup should be output in the HTML - default: `true`
*/ -}}
{{- $lang := .Get "lang" | default "html" -}}
{{- $show_preview := .Get "show_preview" | default true -}}
{{- $show_markup := .Get "show_markup" | default true -}}
{{- $input := .Inner -}}
@ -21,5 +22,5 @@
{{- if eq $show_markup true -}}
{{- $content := replaceRE `<svg class="bd\-placeholder\-img(?:\-lg)?(?: *?bd\-placeholder\-img\-lg)? ?(.*?)".*?<\/svg>\n` `<img src="..." class="$1" alt="...">` $input -}}
{{- $content = replaceRE `(class=" *?")` "" $content -}}
{{- highlight (trim $content "\n") "html" "" -}}
{{- highlight (trim $content "\n") $lang "" -}}
{{- end -}}