gitlabhq/gitlabhq — pull request #8425 by rumpelsepp (2014-12-03 14:52:30+00:00)
Title: DO NOT MERGE: Replace highlight.js with rouge gem

A few day ago I have opened this issue here #8404. I am neither a ruby nor a rails pro but I have managed to create some kind of demo. It is not ready for merge. You could consider it as a proof of concept and for comparing the results between `highlight.js` and [`rouge`](https://github.com/jneen/rouge)

## Again some explanations

* highlight.js is really buggy in getting the correct synthax. The solution is guessing the language with taking the filename, shebang, ... into consideration.
* `pygments` handles this very well but it is a python library
* `rouge` is a highlighter in ruby which is compatible to pygments themes. It is able to do this kind of guessing, too.
* f4b9a65c05f24c3558687c98b5163b465dc46314 reactivates highlight.js language autodetection which is buggy by design.
* look here for some more discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/232#note_622601, #8404

## Limitations

This pull request is not ready. There are some limitations:

* Currently it works only for the blob view. Code blocks using three back ticks could be enabled but I don't know how to do that atm.
* CSS themes have to be included. I enabled inline styles for now, so that you can play around and see any results.
* Line number links are broken.

If you are interested in migrating to `rouge` I need help because as I have already mentioned I am neither a ruby nor a rails pro... :)

## Screenshots

As you can see rouge gets the language correctly even for mixed code.

![bildschirmfoto47](https://cloud.githubusercontent.com/assets/1961699/5282057/1b8875f0-7b03-11e4-9608-a29c826b2bb8.png)
![bildschirmfoto48](https://cloud.githubusercontent.com/assets/1961699/5282058/1b8afeec-7b03-11e4-8c20-1fdfb17af203.png)
![bildschirmfoto49](https://cloud.githubusercontent.com/assets/1961699/5282060/1b9126a0-7b03-11e4-8cf1-96d0fcc2359d.png)
![bildschirmfoto50](https://cloud.githubusercontent.com/assets/1961699/5282061/1b925c82-7b03-11e4-9134-79c379913bb4.png)
![bildschirmfoto51](https://cloud.githubusercontent.com/assets/1961699/5282059/1b900d06-7b03-11e4-988d-61e7d529675a.png)