Files
docker-docs/layouts/_default/_markup/render-codeblock.html
David Karlsson f7bbe06d27 feat: special rendering for codeblock variables
This change adds special rendering for variables in codeblocks.
Variables (placeholder values in examples subject to change)
can be denoted using the following syntax:

    <VARIABLE_NAME>

Using this format will render the variable in a special color, and
without the angle brackets, akin to:

    \033[95mVARIABLE_NAME\033[39m

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2023-10-13 20:17:16 +02:00

23 lines
655 B
HTML

{{ $innerHTML := highlight .Inner .Type
| replaceRE
`&lt;([A-Z_]+)?&gt;`
`<var
class="text-violet-light dark:text-violet-dark font-bold"
>$1</var>`
}}
<div x-data class="group relative">
<button
class="material-symbols-rounded hidden group-hover:block absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600"
title="Copy"
@click="window.navigator.clipboard.writeText($refs.code.textContent.replaceAll(/^\$\s*/gm, ''));
$el.textContent='check_circle';
setTimeout(() => $el.textContent='content_copy', 2000);"
>
content_copy
</button>
<div x-ref="code">
{{- safeHTML $innerHTML -}}
</div>
</div>