Inline syntax highlighting tag

We need a version of the code tag that does syntax highlighting as inline text. For example, I might like to say “You can write add on to a list of numbers by using stringBuilder.append(", ").append(number); or just stringBuilder.append(number); if it’s the first number in the list.” Or maybe “You typed array[index] instead array[index - 1].” Code tags break up a paragraph even if it’s only one line.

So… We can haz [icode]…[/icode] tag, please?

+1 from me.

There’s one more thing annoys me when posting code, tab.




You can write add on to a list of numbers by using [icode]stringBuilder.append(", ").append(number);[/icode] or just [icode]stringBuilder.append(number);[/icode] if it’s the first number in the list.




You typed [icode]array[index][/icode] instead of [icode]array[index - 1][/icode].




The problem is most likely caused by how you calculate your tile positions in combination with float rounding.

For example, mathematically equal multiplications and additions might not equal the exact same value. For example [icode]x = y2 + y;[/icode] might not give the exact same result as [icode]x = y3;[/icode]

The reason why I took this exact example is because that’s most likely what you’re doing for your sprite positions (or what LibGDX does). Consider a tile, it goes from [icode]x1 = tileX * tileSize;[/icode] to [icode]x2 = tileX * tileSize + tileSize;[/icode]

However, the tile next to it at index tileX+1 will start at [icode]x1 = (tileX + 1) * tileSize;[/icode]

Now there’s a chance for those two to be different since [icode]tileX * tileSize + tileSize[/icode] may not be equal to [icode](tileX + 1) * tileSize[/icode]

Rounding the values therefore eliminates the problem, but is not a very elegant solution. =S




[icode]System.out.println(“Only because you asked so kindly.”);[/icode] :-*

[icode]Riven.getInstance().giveMedal();[/icode]

Yes, Riven is a singleton! Who knew? =D

int underscoresNowSupported = 1_000_000L;

Much better. :slight_smile:

Mhmm, inline code. Nice addition to the feature set! :slight_smile:

Shouldn’t it


long underscoresNowSupported = 1_000_000L;

Widening conversion baby, doesn’t matter if the literal’s already an int. And as you can see, the highlighter picks up the L (I imagine it just meant adding underscore to the token regex for numbers)

YES! Very useful feature! [icode]Thanks Riven![/icode]

Ha! Enough medals for this month. See ya in 2013, slackers!