Project

General

Profile

Highlighting in a PRE block (NOT syntax highlighting)

Added by Phil Valentine over 7 years ago

I currently make use of the code syntax highlighting in Redmine tickets which works well using the < pre > < code class="cpp" > mycode.foobar() < /code >< /pre > type arrangement.
However quite often I find it would be REALLY useful to be able to highlight sections of the code (or indeed sections in a < pre > ... < /pre > block) by changing the background colour.

Including %{background:yellow} within the < pre > block won't work.

If I do:
< /pre> %{background:yellow}stuff to highlight% < pre >
then I end up with a break in my block of preformatted text.

Is there a method or trick that I am missing here?

As an example:

    This is preformated text
        Some more text HIGHLIGHT ME and more text
    The end

How would I background highlight the "HIGHLIGHT ME" text in the above example, whilst also keeping it < pre > blocked, (or at least preserving the leading whitespace and monospacing?

Thanks!


Replies (4)

RE: Highlighting in a PRE block (NOT syntax highlighting) - Added by Mischa The Evil over 7 years ago

Phil Valentine wrote:

Is there a method or trick that I am missing here?

Nope, you are not missing anything. Redmine core just does not provide a feature to highlight individual lines within pre or pre/code blocks.

RE: Highlighting in a PRE block (NOT syntax highlighting) - Added by Phil Valentine over 7 years ago

Thanks, a bit annoying, it would be a very useful feature!
Thanks for confirming that I'm not just "missing it" though.

Don't suppose you are aware of any plugins that allow it?

RE: Highlighting in a PRE block (NOT syntax highlighting) - Added by Mischa The Evil over 7 years ago

Phil Valentine wrote:

Don't suppose you are aware of any plugins that allow it?

I am not aware of any that implement this specific feature.

NB: CodeRay (which is the syntax highlighting library that is used by vanilla Redmine) does provide this feature though. However, this library feature itself is not supported by the current Redmine integration, but it might provide you with a start if you are going to look into implementing this feature yourself.

RE: Highlighting in a PRE block (NOT syntax highlighting) - Added by Toni Schilling almost 3 years ago

Hello,
though this question is a little bit aged and possibly answered somewhere else, ...
for me the following works:

This is some preformatted text.
This is very important stuff.
Back to
normal.

So I just use indentation instead of the <pre>.

    (1-4/4)