Posting HTML code to the issues.
Moderators: Developer, Contributor
Posting HTML code to the issues.
Hi! We are using Mantis version 1.1.6 and really apprecaite it.
One question: our webmaster often needs to post HTML code samples into the issues. These may include any tags like div, span, a, table, td, tr, b, i, u etc - often including URLs and tag attributes. The problem is - some parts of the HTML code in mantis issues is rendered as HTML, some not. What we want is to have a possibility of deactivating any HTML interpretation in mantis. Which means - we need html source code as a plain text (as if you open html file in notepad). A primitive example - if a reporter posts <b>http://www.foobar.org</b>, then it should be displayed as a source code, and not as a http://www.foobar.org. Is there a way to do it?
Many thanks in advance!
Alex
One question: our webmaster often needs to post HTML code samples into the issues. These may include any tags like div, span, a, table, td, tr, b, i, u etc - often including URLs and tag attributes. The problem is - some parts of the HTML code in mantis issues is rendered as HTML, some not. What we want is to have a possibility of deactivating any HTML interpretation in mantis. Which means - we need html source code as a plain text (as if you open html file in notepad). A primitive example - if a reporter posts <b>http://www.foobar.org</b>, then it should be displayed as a source code, and not as a http://www.foobar.org. Is there a way to do it?
Many thanks in advance!
Alex
Re: Posting HTML code to the issues.
You have to configure Mantis (put this in your config_inc.php and set it according to your needs):
Code: Select all
############################
# Mantis HTML Settings
############################
# --- html tags -------------------
# Set this flag to automatically convert www URLs and
# email adresses into clickable links
$g_html_make_links = ON;
# These are the valid html tags for multi-line fields (e.g. description)
# do NOT include href or img tags here
# do NOT include tags that have parameters (eg. <font face="arial">)
$g_html_valid_tags = 'p, li, ul, ol, br, pre, i, b, u, em';
# These are the valid html tags for single line fields (e.g. issue summary).
# do NOT include href or img tags here
# do NOT include tags that have parameters (eg. <font face="arial">)
$g_html_valid_tags_single_line = 'i, b, u, em';
Want more plugins to customize Mantis?
=> http://deboutv.free.fr/mantis/
Mantis: 1.1.0, 1.1.0a2
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux
=> http://deboutv.free.fr/mantis/
Mantis: 1.1.0, 1.1.0a2
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux
Re: Posting HTML code to the issues.
Thanks! But this would mean - we need to deactivate all tags. Better would be to mark some blocks as "code" to disable html parsing there. For example, DokuWiki (which we also use) has such a feature - http://www.dokuwiki.org/syntax#non-parsed_blocks Is there any similar trick in Mantis? Thanks!
Re: Posting HTML code to the issues.
You can use mantisbt ver of 1.2.x with Highlight plugin.Vox wrote:Thanks! But this would mean - we need to deactivate all tags. Better would be to mark some blocks as "code" to disable html parsing there. For example, DokuWiki (which we also use) has such a feature - http://www.dokuwiki.org/syntax#non-parsed_blocks Is there any similar trick in Mantis? Thanks!
Re: Posting HTML code to the issues.
I tried your idea, but it seems it's not working. Try this code:Kirill wrote:You can use mantisbt ver of 1.2.x with Highlight plugin.
Code: Select all
<pre><code>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</code></pre>
Re: Posting HTML code to the issues.
Maybe I'm doing something wrong in my code.
BTW, thanks for the plugin
BTW, thanks for the plugin

Re: Posting HTML code to the issues.
Thank you for bug. If you can, test last version from git.Crayon wrote:Maybe I'm doing something wrong in my code.
BTW, thanks for the plugin
Re: Posting HTML code to the issues.
Thanks, for the quick reply. The code is now highlighted correctly, but I'm having problems with multi-line text with carriage return.
In MantisBT Formatting, when Text Processing is ON I get this:

When it's OFF I get this:

The code for the description is:
In MantisBT Formatting, when Text Processing is ON I get this:

When it's OFF I get this:

The code for the description is:
Code: Select all
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<pre>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</pre>
<pre><code>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</code></pre>
Re: Posting HTML code to the issues.
Thanks for bug. Try 0.4.5 version from git 

Re: Posting HTML code to the issues.
Cool it's working now, but I have another problem 
URL are not processed, for example in my description I see this (instead of a link):
BTW: do you have an issue tracker for the Highlight plugin? Or It's best if I continue posting things here?
Thanks

URL are not processed, for example in my description I see this (instead of a link):
Code: Select all
<a href="/mantis/view.php?id=3" title="[feedback] this is for a test">0000003</a>
Thanks
Re: Posting HTML code to the issues.
Yes. I have bugtracker. http://bug.kraeg.ru/
-
- Posts: 3
- Joined: 05 Feb 2010, 12:50
Re: Posting HTML code to the issues.
Hi Kirill, found your plugin today and I'm very excited about it. Just on thing doesn't work:
When I'm using <pre><code> ... something ... </code></pre> then the code inside is rendered very nicely. But when I simply use <b>bold</b> text, then the word bold isn't formatted bold as expected but the tags <b> and </b> are visible as text.
When I turn off highlight then the text is bold, but ofcourse syntax highlighting doesn't work anymore.
Any ideas on how I could get both to work simultaniously?
When I'm using <pre><code> ... something ... </code></pre> then the code inside is rendered very nicely. But when I simply use <b>bold</b> text, then the word bold isn't formatted bold as expected but the tags <b> and </b> are visible as text.
When I turn off highlight then the text is bold, but ofcourse syntax highlighting doesn't work anymore.
Any ideas on how I could get both to work simultaniously?
Re: Posting HTML code to the issues.
Yes, I see that. For now I work for fix it and rebuild main module of plugin.
-
- Posts: 6
- Joined: 23 Sep 2010, 03:39
Re: Posting HTML code to the issues.
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:
-------
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:
- 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!
Hopefully these can be combined somehow.
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>
---
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>
Re: Posting HTML code to the issues.
thehandyman33
If you want help write this plugin, I can add access to work with it.
If you want help write this plugin, I can add access to work with it.