CryptoPaste
CryptoPaste copied to clipboard
Support syntax for languages while entering paste
Supporting syntax colouring could be a potential feature to build in the future
Do you mean updating Highlight.js? Or are you proposing something else?
@anshuman73 Ping, can you update please?
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 ?
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.
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.
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.
Hi, if you want to put add-on like code beautifier you can find libraries on the internet and integrate it
@adrivanrex You're more than welcome to submit a pull request with that or any suitable syntax highlighting library added.
trapizoid
Unlock