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

Please make it work while editing the content #3583

Closed
kopyl opened this issue Jul 15, 2022 · 2 comments
Closed

Please make it work while editing the content #3583

kopyl opened this issue Jul 15, 2022 · 2 comments
Labels
cantfix / wontfix Impossible to fix

Comments

@kopyl
Copy link

kopyl commented Jul 15, 2022

It's not currently possible to highlight the text on the fly.

If I enter this text into contenteditable field, then run this code:

hljs.registerLanguage('terraform', window.hljsDefineTerraform);
hljs.highlightAll();

I get this result: https://i.imgur.com/pYe2l91.png

@kopyl kopyl added bug help welcome Could use help from community parser labels Jul 15, 2022
@kopyl
Copy link
Author

kopyl commented Jul 15, 2022

The HTML becomes this after "highlighting":

https://i.imgur.com/Q6MQL30.jpg

@joshgoebel
Copy link
Member

joshgoebel commented Jul 15, 2022

Live editing is not a supported use case. There are already a plethora of great code editors out there, https://codemirror.net/ just to name one... this is not a category we're interested in competing in.

It's possible this feature could be added using a 3rd party plugin and if so we'd encourage that approach and encourage you (or anyone else) to explore it. If someone wishes to publish and support a plugin to allow this type of thing we'd be more than happy to link to it.

https://highlightjs.readthedocs.io/en/latest/plugin-api.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cantfix / wontfix Impossible to fix
Projects
None yet
Development

No branches or pull requests

2 participants