I couldn't find 'dummy-friendly' instructions for how to install this plugin, so here they are:
INSTALLATION:
- Browse to
http://git.mantisforge.org/w/highlightcode.git
- Click the "snapshot" link next to the version you want (if you're not sure, get the most recent one, at the top of the list, labeled "Master")
- Download and extract the tar.gz file
- Inside the "highlightcode" directory, you'll find the "Highlight" (note the case)
- Upload the "Highlight" directory into the /plugins/ directory in your Mantis install. You should then have a /plugins/Highlight directory.
- Log into your Mantis install, browse to /manage_plugin_page.php
- Under "Available Plugins" (at the bottom), you will see "MantisBT KK Highlight 0.4.6" (version number may vary)
- Click the "Install" link on the right
(These steps worked for me, if anyone has corrections or additions please let me know and I will update the instructions). These are for Mantis 1.2. It would be nice if these instructions were included with the release.
USAGE:
Once you follow the instructions above, usage is hopefully straightforward. Simply surround the code you want highlighted with <pre><code></code></pre>. They have to be in that order. Below are some examples:
Code: Select all
<pre><code>
<b>This is HTML code!</b>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</code></pre>
<pre><code>
<?php
echo 'This is PHP code?';
?>
</code></pre>
<pre><code>
/* This is CSS code */
.highlight {
text-align: right;
}
</code></pre>
-------
So this seems to work well enough... but there are a few issues. Please, if anyone has experience with this plugin and knows of fixes (or alternatives), let me know!
- code highlighting is monochrome... no coloring of any kind (as is common with other highlighters I've used). Comments are grayed out, functions and tags are bold, and regular text is, well, regular text. This is definitely better than nothing, but not by much.
- requires HTML tags to work... and they have to be in the right order, etc. <pre><code> is fine, but what if you want to use these tags in the highlighting? This doesn't work at all:
Code: Select all
<pre><code>
<pre><code>
This code should be highlighted, but it's not!
</code></pre>
</code></pre>
- I think that something like BB Code would work MUCH better, unfortunately I haven't been able to find a plugin or alternate solution for code highlighting in Mantis. The best mention I could find is
http://www.mantisbt.org/bugs/view.php?id=3491 but this bug is currently marked "acknowledged"
---
UPDATE:
The same developer as the one that posted the code highlighting also posted a BBCode parser plugin here:
http://git.mantisforge.org/w/bbcode.git
Unfortunately it only supports a small subset of BBCode, and most notably, does not support the "code" tag, so not much use in this case!
Code: Select all
Supported bbcode:
[b] => <strong>
[i] => <i>
[u] => <u>
[del] => <s>
[sub] => <sub>
[sup] => <sup>
[tt] => <tt>
[img] => <img>
[url] => <a href>
[left] => <div align>
[right] => <div align>
[center]=> <center>
[hr] => <hr>
[color] => <span style>
Hopefully these can be combined somehow.