Skip to content

Commit 5c2ed6f

Browse files
committed
improve: Code block lines, make file name optional
1 parent f7462c6 commit 5c2ed6f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

assets/styles/_gen_syntax.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
.chroma .ln {
33
white-space: pre;
44
user-select: none;
5-
margin-right: 0.4em;
65
padding: 0 0.4em;
76
color: #7f7f7f;
87
}
98

9+
.chroma .cl {
10+
padding: 0 0.4em;
11+
}
12+
1013
.chroma .line {
1114
display: flex;
1215
}
@@ -119,7 +122,6 @@
119122

120123
/* Commented to fix linter errors, uncomment when needed.
121124
.chroma .x,
122-
.chroma .cl,
123125
.chroma .nb,
124126
.chroma .bp,
125127
.chroma .ni,

layouts/_default/_markup/render-codeblock.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- $lang := .Attributes.lang | default .Type -}}
2-
{{- $file := .Attributes.file | default (printf "code-%d.%s" .Ordinal $lang) -}}
2+
{{- $file := .Attributes.file -}}
33

44
{{- /* TODO: Add div toolbar */}}
55
<div class="highlight-wrapper">
@@ -9,10 +9,13 @@
99
<span class="name">{{ $lang }}</span>
1010
</span>
1111

12-
<span class="item">
13-
<span class="label">File:</span>
14-
<span class="name">{{ $file }}</span>
15-
</span>
12+
{{- with $file }}
13+
<span class="item">
14+
<span class="label">File:</span>
15+
<span class="name">{{ . }}</span>
16+
</span>
17+
{{- end }}
18+
1619

1720
<button class="item right outline brighter hide js-btn-copy-code">Copy</button>
1821
</div>

0 commit comments

Comments
 (0)