Reputation: 1716
I am building a Rails 4 app, where I want users to be able to read/write/upload/download files with different kind of files with color highlighting depending on the programming language of the file. Currently I've found a few gems which allow you to read a file and display with color highlighting, just like sublime or any other rich text editor.
I haven't found any text-editor which allows you to choose a language, and based on that highlight the words depending on the language chosen.
I'm looking for something like the editor gistbox has, but haven't found anything yet. Here's an example of what I'm trying to get.
Upvotes: 0
Views: 442
Reputation: 1716
I finally sent a mail to the creator of gisthub, with the following information:
To read a file, and have a nice view in any language use the following: highlightJS
To have a nice editor which recognizes different kind of languages use ace
Upvotes: 0
Reputation: 3835
Have you looked at the gem Github is using? That might be exactly what you want.
If not, it might be possible to use a gem like highlight and use a refresh via jquery to generate a div with the highlighted text, maybe even within the textarea -which could be a little tricky, but should be possible-
Upvotes: 2