Project

General

Profile

Actions

Feature #3032

closed

Use google Prettify for syntax highlighting instead of CodeRay

Added by Kristoffer Grönlund almost 16 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
UI
Target version:
-
Start date:
2009-03-23
Due date:
% Done:

0%

Estimated time:
Resolution:
Wont fix

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 pluggableClosed2009-03-16

Actions
Related to Redmine - Patch #1651: Hack to make redmine use pygmentize instead of CodeRayClosed2008-07-15

Actions
Related to Redmine - Feature #24681: Syntax highlighter: replace CodeRay with RougeClosedJean-Philippe Lang

Actions
Actions #1

Updated by Go MAEDA about 8 years ago

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

Updated by Go MAEDA about 8 years ago

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

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

Actions

Also available in: Atom PDF