fix(code): fix line number styling for better visibility

This commit is contained in:
Cell
2026-05-17 23:43:36 +08:00
parent a4fcc5ed59
commit 78778dad08
2 changed files with 13 additions and 3 deletions
+12 -2
View File
@@ -135,11 +135,20 @@
}
}
// line numbers (lineNumbersInTable=true)
.lnt {
display: block;
width: calc(#{fi-var(line-digit)} * 1ch);
min-width: 0.75rem;
text-align: right;
}
// line numbers (lineNumbersInTable=false)
.ln {
padding-right: 0.75rem;
display: inline-block;
width: calc(#{fi-var(line-digit)} * 1ch);
min-width: 0.75rem;
text-align: right;
padding-right: 0.75rem;
position: sticky;
left: 0;
}
@@ -474,7 +483,8 @@
content: counter(codeNos);
white-space: nowrap;
text-align: right;
min-width: calc(#{fi-var(line-digit)} * 1ch);
width: calc(#{fi-var(line-digit)} * 1ch);
min-width: 0.75rem;
padding-inline: 0.75rem;
flex-shrink: 0;
color: fi-var(global-font-secondary-color);
@@ -19,7 +19,7 @@
{{- $lines := cond .Inner (len (split .Inner "\n")) 0 -}}
{{- $maxShownLines := $config.maxshownlines -}}
{{- $lineNoStart := cond (ne .Options.linenostart nil) .Options.linenostart 1 -}}
{{- $lineNosDigit := strings.RuneCount (add $lines $lineNoStart) -}}
{{- $lineNosDigit := strings.RuneCount (sub (add $lines $lineNoStart) 1) -}}
{{- $class := "highlight" -}}
{{- with $config.class -}}{{ $class = add $class " " . }}{{- end -}}
{{- $targetClass := add "code-block " $class -}}