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 not working as expected #176

Open
jwade0 opened this issue Oct 29, 2024 · 3 comments
Open

Line numbers not working as expected #176

jwade0 opened this issue Oct 29, 2024 · 3 comments

Comments

@jwade0
Copy link

jwade0 commented Oct 29, 2024

Seems that the line numbers are added as a data attr correctly with rehypePrism, but there is no built in styling for the numbers. Am I missing something? I tried the example code in a codesandbox. Thanks!

image
@Jakobud
Copy link

Jakobud commented Nov 18, 2024

I also cannot get line numbers to work at all using the current example. I copy pasted the example 1:1 into this CodeSandbox just as @jwade0 did:

https://codesandbox.io/p/sandbox/https-github-com-uiwjs-react-textarea-code-editor-issues-151-forked-px5jfj?file=%2Fsrc%2FApp.js%3A24%2C1&workspaceId=e268bb81-c582-4f74-bdf5-2e00c927b2a4

image

@lawlie8
Copy link

lawlie8 commented Dec 10, 2024

Any Update on This? Facing the Same Issue

@jacquesg
Copy link

You can try something like the following. I've adjusted the padding of the editor to 24px, and use a 14px font.

.code-line {
  position: relative;
}

.code-line::before {
  position: absolute;
  top: -8px;
  left: -20px;
  padding: 4px;
  content: attr(line);
  color: blue;
}

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

4 participants