0

I'm not sure if this should go in this forum or not so please move it accordingly if necessary.

I was wondering how difficult it would be to implement code highlighting. Personally I like to show the person where their errors might be or are without giving them a direct answer so that they can learn from what they did wrong or smile about the simplicity of it. Currently the only way I can accomplish this is to underline the section of code, this of course means I cannot use the code tags to wrap it up and make it look all pretty. Another idea if this isn't feasible is to allow the underline to be parsed within the code tags.

It would also be really nice to be able to customize the number line so if you repost their code, you could specify what line it is on.

Maybe there is already a way of doing all or a part of this and I just don't know about it?

Thanks for any help provided.

5
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Dani
0

It would also be really nice to be able to customize the number line so if you repost their code, you could specify what line it is on.

Maybe there is already a way of doing all or a part of this and I just don't know about it?

One way of doing this would be to post the code, preview the posted content and update your post with the line number which has been generated by the preview.

0

Actually, to be honest I've found that it would be nice to be able to apply colour tags to lines of code that I'm trying to accentuate when posting code example responses or quoting the original code segment provided by the OP.

Unfortunately, the way the system currently reads the tags, it doesn't seem to read the colour formatting when it's within the code formatting tags.

0

Red color tags do work. just use the [color=red] ... [/color] color tags. Other colors don't work though.

[color=red]This is in red[/color]
[u]This is underlined[/u]
[color=red][u]This is underlined red[/u][/color]
This is not in red.

If you use [code] ... [/code] the above will work as shown. But if you add the language option, such as [code=c] the above doesn't work because of the line numbers.

And I notice that Dani has put back code tags the way they were, without forcing line numbers. I'm glad to see that change.

Edited by Ancient Dragon: n/a

0

just use the [color=red] ... [/color] color tags.

One thing I'm curious about here is whether your example requires the noparse tags you used in order to work. If so, that may be why I had no idea you could do this because I don't recall coming across something in the past which says "if you want to use special formatting within the CODE tag formatting segments, use this additional step to surround the formatting tags or they won't work.

EDIT: I'm obviously not awake yet this morning as the noparse portion was likely just to ensure that the tags you were giving as example would show up without the parser converting them... duh...

In either event, it's interesting to know that color formatting will work in some situations while failing in others. It would be nice to have the ability to use the additional formatting options in all cases instead of a little bit here and a little bit there.

Edited by Lusiphur: n/a

0

Using color within code tags *does not work* when code is syntax highlighted, because the highlighting parser takes control of what color things are. Using color *does work* within code tags that are not syntax highlighted.

Code tags are syntax highlighted manually when you manually specify a language such as . Code tags are syntax highlighted automatically when you are posting within a language forum, such as the C++ forum, and you do not use color bbcode within the code. It is smart enough to make that distinction, and not syntax highlight automatically if you are attempting to color lines in your code.[code=Java]. Code tags are syntax highlighted automatically when you are posting within a language forum, such as the C++ forum, and you do not use color bbcode within the code. It is smart enough to make that distinction, and not syntax highlight automatically if you are attempting to color lines in your code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.