プロジェクト

全般

プロフィール

Vote #64891

完了

Make syntax highlighting pluggable

Admin Redmine さんが4年以上前に追加. 4年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
開始日:
2009/03/16
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
14
issue_org_id:
2985
author_id:
1188
assigned_to_id:
0
comments:
2
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

As discussed in #1651, actual CodeRay support in Redmine is limited, and it could be interesting to make syntax highlighting pluggable. Here is a proposal which keeps actual CodeRay behaviour by default, and allow plugins to implement syntax highlighting. See syntax_highlighting.diff

The second patch prevents Redcloth from escaping some chars when they're in a code block which will be treated by syntax highlighter. There's also a minor change to desactivate a broken (useless?) facility. It doesn't matter for coderay, but other highlighters like "Ultraviolet":http://ultraviolet.rubyforge.org/ cannot parse code with ampersands everywhere... Note this patch is necessary if you want the plugin below to work well in wikis sections (no impact on attached files). Also note the same kind of trick can easily solve #1416. See redcloth.diff

As an example, I leave a basic plugin to support "Ultraviolet":http://ultraviolet.rubyforge.org/ syntax highlighting, with active4d theme. It's quite simple, you just have to make your own module under Redmine::SyntaxHighlighting and define some methods. See ultraviolet_highlighter.zip

Any comment about all that is welcome !


journals

Code highlighting methods where extracted to a module in r3584. It doesn't support online configuration in application settings but it can be replaced with a plugin.
Attached a simple plugin that make use of Ultraviolet. BTW, it seems way slower than Coderay, at least for ruby highlighting.
--------------------------------------------------------------------------------
I read on the German Ruby forum that UV was about 20 times slower that CodeRay. But they really use the TextMate bundles, which are very complex. It's still fast enough for a lot of projects (Pastie, most notably), and they support a lot more languages.

Pygments would be faster, but if you have to call it via a shell command each time you want to highlight something, it may be even slower than Ultraviolet.
--------------------------------------------------------------------------------


related_issues

relates,Closed,1651,Hack to make redmine use pygmentize instead of CodeRay
relates,Closed,3032,Use google Prettify for syntax highlighting instead of CodeRay
relates,Closed,1313,Optionally use ultraviolet for syntax highlighting

Admin Redmine さんが4年以上前に更新

  • カテゴリText formatting_26 にセット
  • 対象バージョン1.0.0 (RC)_14 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0