mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-20 18:50:06 +00:00
code: set wrap-code flag in all cases #1022
- for plain html block code with <pre><code> - removing if highlight code has hl_inline=true
This commit is contained in:
parent
dffe6e1ed0
commit
4a25b6a875
4 changed files with 13 additions and 2 deletions
|
@ -85,7 +85,7 @@
|
|||
|
||||
{{- /* enrich attributes */}}
|
||||
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "highlight" slice) " ")) }}
|
||||
{{- if $wrap }}
|
||||
{{- if and $wrap (not $hl_inline) }}
|
||||
{{- $attributes = merge $options (dict "class" (delimit (append (index $attributes "class" | default slice) "wrap-code" slice) " ")) }}
|
||||
{{- end }}
|
||||
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
<link href="{{"css/auto-complete.css" | relURL}}{{ $assetBusting }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/auto-complete.css" | relURL}}{{ $assetBusting }}" rel="stylesheet"></noscript>
|
||||
<link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ $assetBusting }}" rel="stylesheet">
|
||||
{{- $themevariants := partialCached "_relearn/themeVariants.gotmpl" . }}
|
||||
{{- $wrap := true }}
|
||||
{{- if isset site.Params "highlightwrap" }}
|
||||
{{- $wrap = site.Params.highlightWrap }}
|
||||
{{- end }}
|
||||
{{- if isset .Params "highlightwrap" }}
|
||||
{{- $wrap = .Params.highlightWrap }}
|
||||
{{- end }}
|
||||
{{- $minify := not hugo.IsServer }}
|
||||
{{- if and (isset site.Params "minify") (ne site.Params.minify "") }}
|
||||
{{- $minify = site.Params.minify }}
|
||||
|
@ -25,6 +32,7 @@
|
|||
{{ printf "window.relearn.min = `%s`;" $min | safeJS }}
|
||||
window.relearn.disableAnchorCopy={{ printf "%t" (eq .Site.Params.disableAnchorCopy true) | safeJS }};
|
||||
window.relearn.disableAnchorScrolling={{ printf "%t" (eq .Site.Params.disableAnchorScrolling true) | safeJS }};
|
||||
window.relearn.enableBlockCodeWrap={{ printf "%t" (eq $wrap true) | safeJS }};
|
||||
{{ "// variant stuff" | safeJS }}
|
||||
{{- $quotedthemevariants := slice }}
|
||||
{{- range $themevariants }}
|
||||
|
|
|
@ -1 +1 @@
|
|||
7.3.2+542aafde241ba67ff5310c922972a6e633b49b13
|
||||
7.3.2+dffe6e1ed0dfd9b297cb438839bd1af816021f18
|
|
@ -695,6 +695,9 @@ function initCodeClipboard() {
|
|||
var clone = pre.cloneNode(true);
|
||||
var div = document.createElement('div');
|
||||
div.classList.add('highlight');
|
||||
if (window.relearn.enableBlockCodeWrap) {
|
||||
div.classList.add('wrap-code');
|
||||
}
|
||||
div.appendChild(clone);
|
||||
pre.parentNode.replaceChild(div, pre);
|
||||
pre = clone;
|
||||
|
|
Loading…
Add table
Reference in a new issue