How to Code Syntax Highlight?
Added by Ismail SEZEN over 16 years ago
Please, Somebody can explain how to code syntax highlight? Perhaps, a detailed how to can be added to HowTos:http://www.redmine.org/wiki/redmine/HowTos section.
Thanks;
Replies (10)
RE: How to Code Syntax Highlight? - Added by Mischa The Evil over 16 years ago
You'll find the correct syntaxis to highlight code (in the wiki, messages, note-journals, etc.) at http://www.redmine.org/help/wiki_syntax_detailed.html#13.
HTH...
RE: How to Code Syntax Highlight? - Added by Ismail SEZEN over 16 years ago
Sorry for the confusing by me,
I meant that I need a code syntax highlight for the files in the repository browser. For instance, a code coloring feature would be good for .cs or .cpp files in the project created by C# or C.
RE: How to Code Syntax Highlight? - Added by Mischa The Evil over 16 years ago
Ismail SEZEN wrote:
I meant that I need a code syntax highlight for the files in the repository browser. For instance, a code coloring feature would be good for .cs or .cpp files in the project created by C# or C.
Ahh, that's the thing... :-)
I have just tested this (using r1725) for six languages1 (C, C++, C#, CSS, JavaScript & PHP) by uploading six files of the tested types to my test svn-repo and viewed them using Redmine's Repository viewer.
The results:
Language | Highlighted? |
---|---|
C | Yes |
C++ | Yes |
C# | No |
CSS | No |
JavaScript | Yes |
PHP | Yes2 |
I will do some more research on syntax highlighting in Redmine in general, cause I think I've found some issues with it in other components.
Please let me know what you think. Imo syntax-highlighting should work already for C-programs (*.c)....
1 actually the only "real programming languages" here are C, C++ and C#.
2 it is highlighted in the repository-view only, not in wiki etc.
RE: How to Code Syntax Highlight? - Added by Ismail SEZEN over 16 years ago
You are right, it should work for C-like programming languages at least, and C and C# resembles each other, so C-coloring feature may be used for C#,too. Actually, I'm in wonder if there is any plugin for this purpose? Or should I wait for the future releases? It's very useful to see colored C# codes in the respository browser. In fact I'm a C# developer and I really liked this idea. Perhaps I should make a feature request. :)
RE: How to Code Syntax Highlight? - Added by Mischa The Evil over 16 years ago
Ismail SEZEN wrote:
Actually, I'm in wonder if there is any plugin for this purpose?
At least not that I know of...
Ismail SEZEN wrote:
Or should I wait for the future releases?
That's always a good thing to do, though it doesn't mean that it implemented automatically... :-)
Ismail SEZEN wrote:
Perhaps I should make a feature request.
You could do that, though I think it is somthing that is initially not a thing which should be implemented/fixed/added by Redmine since Redmine relies on a third-party "library" called CodeRay to do the actual highlighting.
Whithin a few days/2 weeks I will perform some more tests. I will keep this thread updated...
RE: How to Code Syntax Highlight? - Added by Jason Milkins over 15 years ago
I'm using the pre/code tags like this...
<pre><code class="ruby">
def myRubyCode
#code...
end
</code></pre>
but it isn't highlighting in page views.
Also when I check the generated page source the class="ruby" tag is gone. (not sure if that's ok or not, considering that CodeRay probably parses the marked code blocks and strips the classes)
Can anyone help me out?
RE: How to Code Syntax Highlight? - Added by Jason Milkins over 15 years ago
def myRubyCode
#code...
end
Just testing here.
RE: How to Code Syntax Highlight? - Added by Jason Milkins over 15 years ago
Jason Milkins wrote:
I'm using the pre/code tags like this...
<pre><code class="ruby">
def myRubyCode
#code...
end
</code></pre>but it isn't highlighting in page views.
Also when I check the generated page source the class="ruby" tag is gone. (not sure if that's ok or not, considering that CodeRay probably parses the marked code blocks and strips the classes)
Can anyone help me out?
I should note that I'm using tag/redmine0.8.2
RE: How to Code Syntax Highlight? - Added by Jason Milkins over 15 years ago
Jason Milkins wrote:
Jason Milkins wrote:
I'm using the pre/code tags like this...
<pre><code class="ruby">
def myRubyCode
#code...
end
</code></pre>but it isn't highlighting in page views.
Also when I check the generated page source the class="ruby" tag is gone. (not sure if that's ok or not, considering that CodeRay probably parses the marked code blocks and strips the classes)
Can anyone help me out?
I should note that I'm using tag/redmine0.8.2
I mean /tags/0.8.2
RE: How to Code Syntax Highlight? - Added by Roman Tataurov over 15 years ago
Just upgrade CodeRay library in /vendor/plugins/ and you will see your ruby code highlighted.