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

highlight-line-numbers causing commented code on uncommented code #82

Open
azamuddin opened this issue Feb 19, 2021 · 0 comments
Open

Comments

@azamuddin
Copy link

Describe the bug
highlight-line-numbers causing commented code on uncommented code

To Reproduce
Steps to reproduce the behavior:

  1. I'm developing nextjs app
  2. importing highlight.js lazy loading using NodeJS import()
  3. importing highlightjs-line-numbers.js lazy loading using NodeJS
  4. calling hljs.highlightBlock then hljs.lineNumbersBlock
  5. first render is no problem
  6. if the component did re-render, which also calls again hljs.highlightBlock and hljs.lineNumbersBlock it broke the highlighting

** Problem **

  • code that is not a commented recognized as comment
  • happens on any code language

Expected behavior
highlight-line-numbers should not modify highlighting done by highlight.js for the subsequent calls

Screenshots
Screen Shot 2021-02-19 at 08 36 20

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version: 88.0.4324.150 (Official Build) (x86_64)

Additional context
I know I can prevent re-calling the method by tracking if it has been called or not. But I also have cases when this is not possible.

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