Jump to content

Recommended Posts

Posted

Greetings,

today we have added support for code highlighting of various programming languages and file formats using the GeSHi - Generic Syntax Highlighter available here.

Use

[ code=[i]language[/i] ]...code...[ /code ]

to highlight code sections you want to post.

E.g. you can post a patch using diff as language.

--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -536,7 +536,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
                else if(m_spellInfo->SpellFamilyFlags & 0x100000000LL)
                {
                    int32 base = irand((int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MINDAMAGE),
(int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MAXDAMAGE));
-                    damage += int32(float(base)/m_caster->GetAttackTime(RANGED_ATTACK)*2800 + m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.2f);
+                    damage += int32(float(base)/m_caster->GetAttackTime(RANGED_ATTACK)*2800 + m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.1f);
                }
                // Explosive Trap Effect
                else if(m_spellInfo->SpellFamilyFlags & 0x00000004)

Or using cpp as language it would result in something like

{
   int32 base = irand((int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MINDAMAGE),
(int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MAXDAMAGE));
   if(m_caster->GetTypeId()==TYPEID_PLAYER)
       base += ((Player*)m_caster)->GetAmmoDPS() * m_caster->GetAttackTime(RANGED_ATTACK)/1000;
   damage += int32(float(base) + m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.1f);
}

  • 1 month later...
  • 4 months later...
Posted

A little update:

You can now use the normal code tag to highlight source code.

E.g. code=diff can be used to color diff output. With the vBulletin 4 upgraded I've modified the syntax highlight plugin to use the normal code tag.

  • 5 months later...
  • 3 months later...
Posted
whee syntax highlighting again :)

Though the colors...maybe it's just me, but blue and purple on dark grey is almost unreadable here...

/sign

a brighter red would be better too ( although its almost readable)

Posted

I just thought "wtf it still is as unreadable as before" but somehow, my browser cached it xD

And yes, much better.

With the light background it is no problem to read, and also doesn't look like someone posted console screenshots anymore ^^

Posted

The highlighting styles are stored in mangos.css, which has an expire time set to (looks like) 14 days after the date you fetched it. If the file is changed your browser normally won't re-request it until after it expires. however clearing your cache or telling your browser to refresh will have it check if it's been modified, if it has it will fetch the new version and update your local cache.

I was about to say that the syntax highlighting color for code=bash looked weird, but as of testing it in this post it has already been changed to a white background making it readable.

The problem was that some symbols and characters [0-9/] were displayed as black and on the dark grey background they were almost invisible.

cd /opt/mangos;
echo 1234 > ./example.txt

Also I was attempting to edit one of my other posts and add syntax highlighting and I received the error

There is a problem with your [ code ] tags

it only occurs when I add the code=lang part, and works fine without it

Posted

If you find posts where the code tag does not work properly, please link them here. I may have to fine tune the parser a bit.

AFAIK the brighter colour schema I have used now, should let you read all the supported highlights now. If not, list the post with bad highlights here, too.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use