diff --git a/hugo.toml b/hugo.toml index 7163a306..e8329253 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1168,7 +1168,7 @@ twemoji = false # set to true, images in the content will be shown as the gallery if the image has a title, e.g. ![alt](src "title") # set to "force", images in the content will be forced to shown as the gallery regardless of the image has a title or not, e.g. ![alt](src) # TODO change gallery engine in the future -lightgallery = true +lightgallery = false # whether to enable the ruby extended syntax ruby = true # whether to enable the fraction extended syntax diff --git a/layouts/_markup/render-codeblock.rss.xml b/layouts/_markup/render-codeblock.rss.xml new file mode 100644 index 00000000..79577aa2 --- /dev/null +++ b/layouts/_markup/render-codeblock.rss.xml @@ -0,0 +1,3 @@ +{{- $result := transform.HighlightCodeBlock . -}} +
{{ $result.Inner }}
+{{- /* EOF */ -}} diff --git a/layouts/_partials/function/code-header.html b/layouts/_partials/function/code-header.html index 850c1594..f0453a84 100644 --- a/layouts/_partials/function/code-header.html +++ b/layouts/_partials/function/code-header.html @@ -1,7 +1,7 @@ {{- /* Code header for classic mode code blocks */ -}} {{- $config := .Config -}} {{- $wrapper := .Wrapper -}} -{{- $type := lower .Type | default "fallback" -}} +{{- $lang := cond (transform.CanHighlight .Type) (lower .Type) "fallback" -}} {{- $name := $config.name -}} {{- $lineNosBtn := "" -}} {{- $lineWrapBtn := "" -}} @@ -33,7 +33,7 @@ {{- with $config.name -}} {{- $titleEl = replace $titleEl `` (printf `` .) -}} {{- end -}} -{{- $codeHeader := printf `
%s%s%s%s%s%s
` $type $titleEl $ellipsisBtn $lineNosBtn $lineWrapBtn $editBtn $copyBtn -}} +{{- $codeHeader := printf `
%s%s%s%s%s%s
` $lang $titleEl $ellipsisBtn $lineNosBtn $lineWrapBtn $editBtn $copyBtn -}} {{- $wrapper = replaceRE `(
)` (printf "%s$1" $codeHeader) $wrapper -}} {{- return $wrapper -}} diff --git a/layouts/_partials/function/xml-content.html b/layouts/_partials/function/xml-content.html index 116e7ab0..70543fd5 100644 --- a/layouts/_partials/function/xml-content.html +++ b/layouts/_partials/function/xml-content.html @@ -4,25 +4,6 @@ {{- $content = dict "Content" .Content "Ruby" .Ruby "Fraction" .Fraction "Fontawesome" .Fontawesome | partial "function/content.html" }} - {{- /* Keep only the code content: remove highlight/chroma/lntable wrapper and line numbers */ -}} - {{- $content = $content | replaceRE `(?s)]*class="highlight"[^>]*>.*?]*class="chroma"[^>]*>.*?]*class="lntable"[^>]*>.*?(?:]*>\s*)?]*>\s*]*class="lntd"[^>]*>.*?\s*]*class="lntd"[^>]*>(.*?)\s*\s*(?:\s*)?.*?.*?
\s*` "$1" -}} - {{- $codeBlocks := findRE `(?s)]*>.*?` $content -}} - {{- if gt (len $codeBlocks) 0 -}} - {{- range $i, $block := $codeBlocks -}} - {{- $newBlock := $block -}} - {{- $textMatches := findRE `>([^<]+)<` $block -}} - {{- if gt (len $textMatches) 0 -}} - {{- range $j, $m := $textMatches -}} - {{- $inner := $m | replaceRE `^>([^<]+)<$` "$1" -}} - {{- $newInner := replace $inner " " " " -}} - {{- $newMatch := printf ">%s<" $newInner -}} - {{- $newBlock = replace $newBlock $m $newMatch -}} - {{- end -}} - {{- end -}} - {{- $content = replace $content $block $newBlock -}} - {{- end -}} - {{- end -}} - {{- /* Keep only the first
...
inside a diagram-container */ -}} {{- $content = $content | replaceRE `(?s)]*class="diagram-container"[^>]*>.*?(]*class="mermaid"[^>]*>.*?).*?\s*(?:]*>.*?\s*)?` "$1" }} {{- $mermaidMatches := findRE `(?s)]*class="mermaid"[^>]*>.*?` $content -}} diff --git a/layouts/_partials/init/index.html b/layouts/_partials/init/index.html index 665082d0..02ed4bc0 100644 --- a/layouts/_partials/init/index.html +++ b/layouts/_partials/init/index.html @@ -1,4 +1,4 @@ -{{- hugo.Store.Set "version" "v0.4.0-alpha.3-20251219061028-5dcb107d" -}} +{{- hugo.Store.Set "version" "v0.4.0-alpha.3-20251219073856-c35dce56" -}} {{- .Store.Set "this" dict -}} {{- partial "init/detection-env.html" . -}}