Feature #3032
closedUse google Prettify for syntax highlighting instead of CodeRay
0%
Description
I believe it would be preferrable to use the google prettify syntax highlighter rather than Coderay for syntax highlighting in Redmine.
It has support for a much larger set of languages, and highlights the code clientside via javascript rather than serverside (so the pre-formatted code stays readable when looking at the source).
I have hacked support for this into our redmine installation, and the necessary changes (if letting coderay stay active as well) are minimal.
1. Copy the prettify .js files to public/javascripts/ 2. Copy the prettify .css file to public/stylesheets/
Now, I'm not a rails coder, so the following step is probably not the cleanest solution. I'll describe it anyway for completeness:
3. Modify app/views/layouts/base.rhtml with the following changes: 3.1. add onload="prettyPrint()" to the body tag. 3.2. link to prettify.js and prettify.css in the header. 4. Put code in pre blocks with class "prettyprint".
That's all.
Related issues
Updated by Go MAEDA about 8 years ago
- Related to Patch #1651: Hack to make redmine use pygmentize instead of CodeRay added
Updated by Go MAEDA about 8 years ago
- Related to Feature #24681: Syntax highlighter: replace CodeRay with Rouge added
Updated by Go MAEDA about 6 years ago
- Status changed from New to Closed
- Resolution set to Wont fix
The syntax highlighter has been replaced with Rouge in #24681 and it supports most popular languages.
https://github.com/jneen/rouge/wiki/List-of-supported-languages-and-lexers