As title; unless there's already a way:

<html>
<head>
<script type="text/javascript">
function myfunction( )
{
  alert( "Hello, World!");
}
</script>
</head>
<body>
<p>Some HTML code</p>
<img onclick="myfunction( );" src="some_image.gif"/>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function myfunction( )
{
  alert( "Hello, World!");
}
</script>
</head>
<body>
<p>Some HTML code</p>
<img onclick="myfunction( );" src="some_image.gif"/>
</body>
</html>

Not a major problem, I know, This example doesn't show the problem well, but when posting loads of HTML, with loads of Javascript in the same block; I find myself having to 'pick' between one or other inperfect formats.. HTML+Javascript could highlight both..

On another note.. there's a style leak in the HTML formatter:

<a href="

My signature will be blue! That's a minor, almost insignificant, problem though.

EDIT: Ah, it seems to spill further than my signature..!

Recommended Answers

All 18 Replies

I'm not sure what you typed to get the "leak". I think it must've parsed itself or something.

If you open an HTML element attribute and forget to close it within an HTML code block; then the 'blue' style continues into the rest of the post, and, if your thread view is linear > oldest first ( mine is usually linear > newest first ), the blue spreads into other peoples posts aswell; and then it goes on into the rest of the daniweb interface. I think it's the same with C++ strings:

std::string hello( "hi

On original topic; what are your thoughts on an HTML+Javascript syntax highlighting mode?

I didn't write the syntax highlighting parser.

If you open an HTML element attribute and forget to close it within an HTML code block; then the 'blue' style continues into the rest of the post, and, if your thread view is linear > oldest first ( mine is usually linear > newest first ), the blue spreads into other peoples posts aswell; and then it goes on into the rest of the daniweb interface. I think it's the same with C++ strings:

std::string hello( "hi

I am not able to reproduce this. :(

Ah... it's not doing it on Firefox, only Opera.. strange :|

Hm.. the code for this page looks wierd here though:

<div class="de1">[B]<span class="st0"</span>[/B]</div></li></ol></pre>

and here:

&lt;a</span> <span class="kw3">href</span>=<span class="st0">&quot;</span></div></li><li class="li1"><div class="de1"><span class="st0">[B]</span</span>[/B]</div

Assuming that's autogenerated by the syntax highlighter; I would assert that that's where it goes wrong, and that Opera and FF have different ways of dealing with the glitch.

Member Avatar for iamthwee

Yes I get the same thing in Opera, and I use Opera as my main web browser...

I've been working on the problem today. The problem is definitely a bug with the syntax highlighter, and it looks as if the author has provided a workaround as this bug was previously reported. Still working on it.

BTW thanks for the catch. I am not an Opera user so I never would have caught it.

I am seeing the line numbers overlapping on some of these. See post 6.

I'm not sure what you mean. Can you take a screenshot?

Here it is. Look at the code area. The line numbers are overlapping.

I have Firefox 2.0.0.6 on Windows XP, resolution 1152 X 864.

Does this happen when there are multiple lines of code? Every line overlaps?

In Opera, I only see a single line ( and single line number ) in my posted codeblock..

But, there's a superfluous <li> in the HTML close to the screwy '</span</span>' part.. So, there should really be another line number shown.

In Firefox 2, I see the same as MidiMagic, a pair of line numbers, with one over the other; but ONLY in this (unfinished quote) case and normally they are absolutely fine.

The browsers are dealing with the bad bit of data differently, which is unsuprising really, since 'correct' behaviour isn't defined. Opera hides the next <li> and spills blue from the unclosed quote to the end of the Daniweb page, Firefox squashes the next <li> and continues as per usual.

I thought there'd be quite a simple explanation, like the parser starting a blue span and not closing it.. that's what it looks like in Opera. Personally, I wouldn't rank this problem as 'high priority' if you're having trouble nailing it down.. It doesn't seem to be exploitable.

Oh I forgot to mention, I fixed the problem (I think) yesterday but it only applies to new posts. Testing testing ...

<a href="
std::string hello( "hi

It blued out for me again, see attached. My post wasn't showing blue until you started it all over again =P.

Oh I forgot to mention, I fixed the problem (I think) yesterday but it only applies to new posts. Testing testing ...

<a href="
std::string hello( "hi

It did it only on the last two lines, and then only if the last line was empty.

These are OK.

It blued out for me again, see attached. My post wasn't showing blue until you started it all over again =P.

I haven't seen this blue at all in Firefox.

Something is bloo-ey.

Since it involves busted span tags, maybe we should call this bloo problem "span spam."
:icon_mrgreen:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.