feat(layout): add the language and a button to copy code blocks
This commit is contained in:
parent
7c3facdd0f
commit
7b84496201
3 changed files with 124 additions and 12 deletions
13
layouts/_markup/render-codeblock.html
Normal file
13
layouts/_markup/render-codeblock.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{- $result := transform.HighlightCodeBlock . }}
|
||||
<div class="highlight">
|
||||
<div>
|
||||
{{- .Type -}}
|
||||
<span data-action="copy">copy</span>
|
||||
</div>
|
||||
<pre tabindex="0" class="chroma">
|
||||
{{- /* chomp newline */ -}}
|
||||
<code class="language-{{ .Type }}" data-lang="{{ .Type }}">{{ $result.Inner }}</code>
|
||||
{{- /* chomp newline */ -}}
|
||||
</pre>
|
||||
</div>
|
||||
{{- /* chomp trailing newline */ -}}
|
Loading…
Add table
Add a link
Reference in a new issue