Question

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. enter image description here

Was it helpful?

Solution 2

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

OTHER TIPS

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-

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top