2

The most Users which use redmine, are programmers. They need the code highlight syntax very, very often which is.

< pre >< code class="LANGUAGE_NAME" >

   Some Code

< /code>< /pre>
  • In order to write less, as an editor in the redmine wiki
  • I want to be able to press a button or a dropdown field, which surrounds my selected text (like bold, italic, underlined, pre, h1, h2 and so on which already does.)

Maybe someone can suggest a plugin if that exists. Or shows me the code where the editor happens, so I can implement and provide it as plugin.

Many, many, thanks

Jan
  • 12,992
  • 9
  • 53
  • 89

3 Answers3

5

I made a plugin which provides this functionality:

https://github.com/mediatainment/redmine_codebutton/

Hope this helps someone, till redmine implements it by default.

Jan
  • 12,992
  • 9
  • 53
  • 89
3

There is a "PRE" button in the Redmine Wiki toolbar, which partially does, what you want. I.e., it surrounds the code with just <pre>. At least, you will be able to use this button as a sample...

I'm not aware of any plugin, which comes with the button, you request...

Redmine lets you add any button to the Wiki toolbar. For this you just need to add an element to jsToolBar.prototype.elements as follows:

jsToolBar.prototype.elements.ruby = {
    type: 'button',
    title: 'Ruby code',
    fn: {
        wiki: function() { /* handle it here */ this.encloseLineSelection('<pre><code class="ruby">\n', '\n</code></pre>') }
    }
};

See also: javascripts/jstoolbar/textile.js.

Andriy Lesyuk
  • 512
  • 2
  • 16
  • wow, thank you Andriy. I will give a try and will share my result as a plugin. I think it will be very helpful to make the editor happy and keep the wiki clean and readable. :-) – Jan Oct 15 '13 at 10:08
  • Hi Andriy, have done some work ;-)Thank you very much – Jan Nov 04 '13 at 10:54
0

If someone is still have that problem I recently uploaded redmine plugin that replaces built-in coderay with highlightJS. Plugin feature much more markups, very good language autodetection as well as dual language highlighting (i.e http+json in body). Plugin url is:

https://github.com/dominch/redmine_highlightjs

Language autodetection works great, so probably You will no longer need to input specific language class. Plugin takes care about that and just work!

DMC
  • 188
  • 1
  • 6