[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line numbers #10

Closed
mattcroat opened this issue Apr 17, 2024 · 0 comments
Closed

Line numbers #10

mattcroat opened this issue Apr 17, 2024 · 0 comments

Comments

@mattcroat
Copy link
Contributor

Is there a simpler way of adding line numbers to code blocks besides using CSS counters?

It kind of works but it's not perfect.

line-numbers.mp4
pre {
  counter-reset: count 1;
}

pre br + span {
  position: relative;
  font-family: monospace;
  counter-increment: count;
}

pre span:nth-of-type(1)::before,
pre br + span::before {
  content: counter(count);
  position: absolute;
  top: 0px;
  left: -60px;
  color: #fff;
  opacity: 0.2;
}
@antfu antfu closed this as completed in eca8780 Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant