سؤال

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

هل كانت مفيدة؟

المحلول

I made a plugin which provides this functionality:

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

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

نصائح أخرى

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.

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!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top