문제

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