C# scanner file for CodeRay
I'm a C# programmer and don't have much knowledge on RoR.
When I came to Remine, the code highlighting tool "CodeRay" doesn't support C# right now. So I think I need to replace it with another highlighting tool, or make an extension for CodeRay.
There is already a Java scanner file in the current CodeRay library. So I tried to write a C# one according to the Java one. Fortunately, it went smoothly.
The attachment file is the C# scanner I made. It is a temporary solution, because I wrote it just for CodeRay 0.7.6.227, which is also the version Remine is currently using, although there seems to be some improvements in the newer versions of CodeRay. According to the CodeRay roadmap, C# support will be added in version 1.1.
Put the csharp.rb in
And then you may use <pre><code class="csharp">.... block now.
(Optional) You may add aliases in the file
(Optional) You may add file extensions' mappings in the file . And following is my settings:
'cs' => :csharp, 'config' => :xml, 'aspx' => :html, 'resx' => :xml, 'asax' => :html, 'ashx' => :html, 'xaml' => :xml, 'csproj' => :xml, 'xsd' => :xml, 'xsc' => :xml, 'xss' => :xml, 'settings' => :xml,
csharp.rb (4.77 KB)
RE: C# scanner file for CodeRay - Added by Steven Pardo over 12 years ago
Thanks for the c# scanner. It makes our code snippets much easier to read.
RE: C# scanner file for CodeRay - Added by Josh Galvez over 12 years ago
RE: C# scanner file for CodeRay - Added by Dmitry Popov over 9 years ago
I've created a C# scanner for CodeRay 1.0.9 based on C++.
RE: C# scanner file for CodeRay - Added by Mr. DTTH about 9 years ago
Please update to redmine 2.3.x
In new version redmine, don't found path "redmine folder>vendor/plugins/coderay-0.7.6.227/lib/coderay/scanners"
RE: C# scanner file for CodeRay - Added by Dmitry Popov about 9 years ago
I put it in Coderay directory:
RE: C# scanner file for CodeRay - Added by Tide _ almost 9 years ago
Where did you put coderay_vscolors.css or what did you do with it?
RE: C# scanner file for CodeRay - Added by Dmitry Popov almost 9 years ago
Append it to Redmine stylesheet by copying its contents or using
RE: C# scanner file for CodeRay - Added by Nayuta Taga almost 7 years ago
I have wrote another C# scanner https://github.com/ganaware/coderay/commit/ed8360837166b9f06cc60a86ffba0e776c74d43b .
It is based on coderay 1.1.1.rc1 (not yet released), and tested on redmine-3.1.0 .
1. how to install my patched coderay¶
$ git clone https://github.com/ganaware/coderay.git
$ cd coderay $ git checkout csharp-scanner $ gem build coderay.gemspec
$ sudo gem install ./coderay-1.1.1.rc1.gem $ gem list coderay *** LOCAL GEMS *** coderay (1.1.1.rc1, 1.1.0)
2. setup your redmine¶
Edit redmine's Gemfile,
--- /your-redmine-directory/Gemfile~ 2015-07-26 16:11:01.000000000 +0900 +++ /your-redmine-directory/Gemfile 2015-08-17 17:23:54.000000000 +0900 @@ -6,7 +6,8 @@ gem "rails", "4.2.3" gem "jquery-rails", "~> 3.1.3" -gem "coderay", "~> 1.1.0" +#gem "coderay", "~> 1.1.0" +gem "coderay", "=1.1.1.rc1" gem "builder", ">= 3.0.4" gem "request_store", "1.0.5" gem "mime-types"
run bundler and then restart your web server.
$ cd /your-redmine-directory/ $ bundle install $ <restart-your-web-server>
If newer coderay will be released, you should uninstall my patched coderay.
$ sudo gem uninstall coderay -v 1.1.1.rc1
Restore redmine's original Gemfile,
run bundler again
and then restart your web server.