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

Support syntax for languages while entering paste #1

Open
anshuman73 opened this issue May 23, 2017 · 7 comments
Open

Support syntax for languages while entering paste #1

anshuman73 opened this issue May 23, 2017 · 7 comments

Comments

@anshuman73
Copy link

Supporting syntax colouring could be a potential feature to build in the future

@Kage
Copy link
Member

Kage commented Jun 1, 2017

Do you mean updating Highlight.js? Or are you proposing something else?

@Kage
Copy link
Member

Kage commented Jun 11, 2017

@anshuman73 Ping, can you update please?

@anshuman73
Copy link
Author

Hi, sorry for the delayed response.
I was suggesting setting Syntax highlighting for languages while the text is being entered.

currently, the viewer chooses the language to highlight the syntax for, wouldn't it be better if the paster can set the syntax too and the viewer gets that syntax highlighting automatically ?

@anshuman73
Copy link
Author

A potential way could be to store the language in the crypt, but (with my limited cryptographic knowledge), I believe it would make the crypt insecure.

@anshuman73 anshuman73 changed the title Support syntax for languages Support syntax for languages while entering paste Jun 14, 2017
@Kage
Copy link
Member

Kage commented Jun 15, 2017

I had thought about some method of storing a language pre-set (e.g. injecting a language marker into the paste before being encrypted), but I decided not to namely since I wasn't sure how to do the whole thing well.

I don't know of a good way to take Highlight.js and apply it to a rich text editor. If you have some idea, I'd be delighted to review a pull request.

@Kage
Copy link
Member

Kage commented Sep 9, 2017

After looking around, it appears CodeMirror would be the best option here. It would need to make sure to invoke the cmObj.toTextArea() function before doing the in-browser encryption. Also needs to provide a selection for languages (listed from CodeMirror.modes object), then I believe use cmObj.setOption('mode', '<language>') to change them.

@Kage
Copy link
Member

Kage commented Dec 20, 2019

@adrivanrex You're more than welcome to submit a pull request with that or any suitable syntax highlighting library added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants