feat(notes): show line numbers on non-markdown file views
All checks were successful
CI / verify (push) Successful in 2m8s

CSS counters on the per-line spans, scoped to .code-file so fenced
blocks inside notes stay untouched. The gutter width adapts to the
file's line count and numbers are excluded from text selection.
This commit is contained in:
Julien Calixte
2026-07-03 16:57:09 +02:00
parent 84a252e926
commit 5386fa66ea
3 changed files with 74 additions and 2 deletions

View File

@@ -186,6 +186,24 @@ pre {
overflow-wrap: anywhere;
}
/* Line numbers for whole-file code views (non-markdown files).
Scoped to .code-file so fenced blocks inside notes stay untouched. */
.code-file pre code {
counter-reset: line;
}
.code-file pre code .line::before {
counter-increment: line;
content: counter(line);
display: inline-block;
width: var(--line-number-width, 3ch);
margin-right: 1.5ch;
text-align: right;
color: var(--color-base-content);
opacity: 0.35;
user-select: none;
}
pre.mermaid {
display: flex;
justify-content: center;