Feature #3032

Use google Prettify for syntax highlighting instead of CodeRay

Added by Kristoffer Grönlund over 9 years ago.

Status:NewStart date:2009-03-23
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:-
Resolution:

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.

Link:
http://code.google.com/p/google-code-prettify/


Related issues

Related to Redmine - Feature #2985: Make syntax highlighting pluggable Closed 2009-03-16
Related to Redmine - Patch #1651: Hack to make redmine use pygmentize instead of CodeRay New 2008-07-15
Related to Redmine - Feature #24681: Syntax highlighter: replace CodeRay with Rouge New

History

#1 Updated by Go MAEDA over 1 year ago

  • Related to Patch #1651: Hack to make redmine use pygmentize instead of CodeRay added

#2 Updated by Go MAEDA over 1 year ago

  • Related to Feature #24681: Syntax highlighter: replace CodeRay with Rouge added

Also available in: Atom PDF