content: Replace calls to the code shortcode with fenced code blocks

This commit is contained in:
Joe Mooring authored and GitHub committed 2025-03-06 02:49:11 -08:00
1 parent b23c9a583a
commit fd628be6ed
110 files changed
+483 -555

No files matched your search

@@ -16,7 +16,7 @@ may also specify the following parameters:
fmt.Println("Hello world!")
```
```go {linenos=true copy=true file="layouts/index.html"}
```go {linenos=true file="layouts/index.html" copy=true}
fmt.Println("Hello world!")
```
*/}}
@@ -26,9 +26,12 @@ may also specify the following parameters:
{{- $file := or .Attributes.file "" }}
{{- $ext := strings.TrimPrefix "." (path.Ext $file) }}
{{- $lang := or .Type $ext "text" }}
{{- if eq $lang "html" }}
{{- if in (slice "html" "gotmpl") $lang }}
{{- $lang = "go-html-template" }}
{{- end }}
{{- if eq $lang "md" }}
{{- $lang = "text" }}
{{- end }}
{{- with .Attributes.copy }}
{{- if in (slice true "true" 1) . }}
@@ -46,7 +49,7 @@ may also specify the following parameters:
{{- if $copy }}
{{- $fileSelectClass = "select-text" }}
<svg
class="absolute right-3 top-2 z-30 text-blue-600 hover:text-blue-500 dark:text-gray-400 dark:hover:text-gray-300 cursor-pointer w-6 h-6"
class="absolute right-4 top-2 z-30 text-blue-600 hover:text-blue-500 dark:text-gray-400 dark:hover:text-gray-300 cursor-pointer w-6 h-6"
@click="$copy($refs.code)">
<use href="#icon--copy"></use>
</svg>
+1 -1
View File
@@ -72,7 +72,7 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
<div x-data class="shortcode-code not-prose relative p-0 mt-6 mb-8">
{{- if $copy }}
<svg
class="absolute right-3 top-12 z-30 text-blue-600 hover:text-blue-500 cursor-pointer w-6 h-6"
class="absolute right-4 top-12 z-30 text-blue-600 hover:text-blue-500 cursor-pointer w-6 h-6"
@click="$copy($refs[$store.nav.userSettings.settings.configFileType])">
<use href="#icon--copy"></use>
</svg>
-38
View File
@@ -1,38 +0,0 @@
{{- $codeLang := or (.Get "lang") "" }}
<div
x-data
class="shortcode-code font-mono not-prose relative mt-6 mb-8 border-1 border-gray-200 dark:border-gray-800 bg-light dark:bg-dark">
{{ if (.Get "copy") }}
<svg
class="absolute right-4 top-2 z-30 text-blue-600 hover:text-blue-500 cursor-pointer w-6 h-6"
@click="$copy($refs.code)">
<use href="#icon--copy"></use>
</svg>
{{ end }}
{{- with .Get "file" -}}
{{- if not $codeLang }}
{{- $ext := strings.TrimPrefix "." (path.Ext .) }}
{{- $codeLang = cond (eq $ext "html") "go-html-template" $ext }}
{{- end }}
<div
class="san-serif text-sm inline-block leading-none pl-2 py-3 bg-gray-300 dark:bg-slate-700 dark: w-full select-none
">
{{ . }}
</div>
{{- end -}}
<div class="" x-ref="code">
{{ $inner := trim .Inner "\n" | safeHTML }}
{{ if .Get "nocode" }}
{{ $inner }}
{{ else }}
{{ with $codeLang }}
{{ highlight $inner . "" }}
{{ else }}
<pre class="overflow-x-auto p-2 w-[93%]"><code>{{ $inner }}</code>
</pre>
{{ end }}
{{ end }}
</div>
</div>