mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-19 03:10:24 +00:00
highlight: don't switch to block view if hl_inline=true #618
This commit is contained in:
parent
cbfe2076cf
commit
f51f843ca6
2 changed files with 11 additions and 2 deletions
|
@ -80,7 +80,7 @@ print("Hello World!")
|
||||||
| Name | Default | Notes |
|
| Name | Default | Notes |
|
||||||
|-----------------------|------------------|-------------|
|
|-----------------------|------------------|-------------|
|
||||||
| **type** | _<empty>_ | The language of the code to highlight. Choose from one of the [supported languages](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages). Case-insensitive. |
|
| **type** | _<empty>_ | The language of the code to highlight. Choose from one of the [supported languages](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages). Case-insensitive. |
|
||||||
| **title** | _<empty>_ | **Extension**. Arbitrary title for code. This displays the code like a [single tab]({{% relref "shortcodes/tab" %}}). |
|
| **title** | _<empty>_ | **Extension**. Arbitrary title for code. This displays the code like a [single tab]({{% relref "shortcodes/tab" %}}) if `hl_inline=false` (which is Hugos default). |
|
||||||
| **wrap** | see notes | **Extension**. When `true` the content may wrap on long lines otherwise it will be scrollable.<br><br>The default value can be set in your `config.toml` and overwritten via frontmatter. [See below](#configuration). |
|
| **wrap** | see notes | **Extension**. When `true` the content may wrap on long lines otherwise it will be scrollable.<br><br>The default value can be set in your `config.toml` and overwritten via frontmatter. [See below](#configuration). |
|
||||||
| **options** | _<empty>_ | An optional, comma-separated list of zero or more [Hugo supported options](https://gohugo.io/functions/highlight/#options) as well as extension parameter from this table. |
|
| **options** | _<empty>_ | An optional, comma-separated list of zero or more [Hugo supported options](https://gohugo.io/functions/highlight/#options) as well as extension parameter from this table. |
|
||||||
| _**<option>**_ | _<empty>_ | Any of [Hugo's supported options](https://gohugo.io/functions/highlight/#options). |
|
| _**<option>**_ | _<empty>_ | Any of [Hugo's supported options](https://gohugo.io/functions/highlight/#options). |
|
||||||
|
|
|
@ -47,6 +47,15 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $options = $otherOptions }}
|
{{- $options = $otherOptions }}
|
||||||
{{- $attributes = $attributes | merge $otherAttributes }}
|
{{- $attributes = $attributes | merge $otherAttributes }}
|
||||||
|
{{- $hl_inline := false }}
|
||||||
|
{{- if and (isset $page.Params "markup") (isset $page.Params.markup "highlight") (isset $page.Params.markup.highlight "hl_inline") }}
|
||||||
|
{{- $hl_inline = $page.Params.markup.highlight.hl_inline }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $k, $v := $options }}
|
||||||
|
{{- if eq $k "hl_inline" }}
|
||||||
|
{{- $hl_inline = $v }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- $params := slice }}
|
{{- $params := slice }}
|
||||||
{{- range $k, $v := $options }}
|
{{- range $k, $v := $options }}
|
||||||
{{- $params = $params | append (printf "%s=%s" $k $v) }}
|
{{- $params = $params | append (printf "%s=%s" $k $v) }}
|
||||||
|
@ -75,7 +84,7 @@
|
||||||
{{- if $wrap }}
|
{{- if $wrap }}
|
||||||
{{- $content = replaceRE "^([\\s\\n\\r]*<div\\s+class=\")" "${1}wrap-code " $content 1 }}
|
{{- $content = replaceRE "^([\\s\\n\\r]*<div\\s+class=\")" "${1}wrap-code " $content 1 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $title }}
|
{{- if and $title (not $hl_inline) }}
|
||||||
{{ partial "shortcodes/tab.html" (dict
|
{{ partial "shortcodes/tab.html" (dict
|
||||||
"page" $page
|
"page" $page
|
||||||
"title" $title
|
"title" $title
|
||||||
|
|
Loading…
Reference in a new issue