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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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. :-)
Hi Andriy, have done some work ;-)Thank you very much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.