Proper Forum Code Formatting Guide

44 posts

Flag Post

Reading posts without code properly formatted causes more problems then it solves because we are forced to attempt to interpret what the intended code was, and it’s not always right.

Code blocks

To get this:

Some text. next line must be blank

[ code here ]

some more text. next line must be blank

[ code ]
[ code ]
[ code ]

still more text

You need to do this:

Some text. next line must be blank
 
<pre>[ code here ]</pre>
 
some more text. next line must be blank
 
<pre>[ code ]
[ code ]
[ code ]</pre>
 
still more text

    Not having blank lines before <pre>
    and after </pre> will cause issues.

Inline Code

For small single lines of code, or to make something stand out a bit use code tags or the @ symbol, as such:

Yet more text <code>[ code ]</code> and more text @[ code ]@

To get:

Yet more text [ code ] and more text [ code ]


Preventing Formatting

To get special characters like @ without them being formatted enclose them in == or notextile blocks, < or > when they’re around certain words (like pre, a, p, etc.) and &:

Yet more text ==*asterisks*== and more text <notextile>@[ code ]@</notextile> &lt;a&gt; &amp;

To get:

Yet more text *asterisks* and more text @[ code ]@ <a> &

 
Flag Post

Yeah except Kongregate forums suck and preserve interprets asterisk and underscores anyway…

 
Flag Post

no it doesn’t.

_x = m / -1 +(q+ t *w* G- a._y);

code: _x = m / -1 +(q+ t *w* G- a._y);

x = m / 1 (q t w G a.y);

you’ll also want to notice that an empty line goes BEFORE <pre> not after. and that another empty line (if you want more text below it) goes AFTER </pre> not before

 
Flag Post

It’s about time one of these threads was stickied.

 
Flag Post

and use &# 60; and &# 62; to make < and > (no spaces) or else it will be treated like a tag during some cases.

 
Flag Post
Originally posted by jonathanasdf:

easier to use &lt; and &gt;

lt = less than, gt = greater than.

although it won’t matter if it’s in pre tags.

And STICKY THIS PL0xXx

Edit: actually it won’t matter for forums, only matters for chat. forums nonsense tags or blocked tags won’t be formatted.

see?

<asdf></asdf>

<font></font>

Well, it is very useful to use &# 95; for “_” and &# 42; for “*” because of Kong’s stupid formatting settings. (You can use the text version also instead of this ASCII numberic version to display such characters.)

 
Flag Post
Originally posted by jonathanasdf:

you can still just put them in the pre tag and they won’t be formatted…. which I find easier to use.

…No, you can’t. The website’s settings > the “pre” tag’s settings for those characters.

 
Flag Post
Originally posted by jonathanasdf:
Originally posted by skyboy:

no it doesn’t.

_x+=_y/(q+t*w*G-m);

code: _x+=_y/(q+t*w*G-m);

x+=y/(q+t*w*G-m);

you’ll also want to notice that an empty line goes BEFORE <pre> not after. and that another empty line (if you want more text below it) goes AFTER </pre> not before

please read the entire thread first. kthxbai

Have you tried it yourself?

root.mc.height += Math.random()*20;

Notice that _root.mc. is in italics.

 
Flag Post
Originally posted by jonathanasdf:

Have you tried doing what it said? empty line before the <pre> tag!

_root.mc._height += Math.random()*20;

That’s not what you origionally said, that’s what skyboy said. Please lock.

 
Flag Post
Originally posted by skyboy, up at the top of this here thread

not having empty lines before <pre> and after </pre> will cause issues.

specifically, it will put in a lot of goddamn whitespace into your code, which I couldn’t figure out until just now. much obliged, skyboy.

This is what you want:

while(true)
{
   trace("My milkshake brings all the boys to the yard");
   trace("And there like, its better than yours.");
   trace("damn right, its better than yours.");
   trace("I could teach you, but I'd have to charge.");
}

and this is what you get if the <pre> tag don’t have their hard returns.


while(true)
{
trace(“My milkshake brings all the boys to the yard”);
trace(“And there like, its better than yours.”);
trace(“damn right, its better than yours.”);
trace(“I could teach you, but I’d have to charge.”);
}

 
Flag Post

You can also just use

  <pre><code>
    [ code *goes* _here_ ]
  </code>< /pre>

Which gives you this:


  [ code *goes* _here_ ]

And not worry about spacing.

 
Flag Post

that makes it difficult to read; and it’s really easier to just press enter twice before typing <pre> and again after typing </pre>

 
Flag Post

 
Flag Post
Originally posted by Bray21:


And the point of that was?

 
Flag Post

To bring the topic back to the top… So People will actaully READ IT

 
Flag Post

this should be sticky’d

 
Flag Post

I agree.

 
Flag Post

yes..

 
Flag Post
[test]
 
Flag Post
hello
//------------------------------------- PROGRESSBAR AS3 ------------------------------------------------//
//create timer
var progressBarTimer:Timer = new Timer(250);
//addEventlistenener
progressBarTimer.addEventListener (TimerEvent.TIMER, progressBarTimerEvent);
//timer start
progressBarTimer.start ();
//progressbar timer event
function progressBarTimerEvent (event:TimerEvent):void {
	//whole number of precent loaded
	progress = (( video01_ns.bytesLoaded / video01_ns.bytesTotal * 100 ) >> 0);
	//create number equal to precent of progress percent and bar width
	var newWidth:Number =((progress * barWidth *.01) >> 0);
	//set x
	nav_mc.progressBar.x = nav_mc.seekBar.x + newWidth;
	//set width
	nav_mc.progressBar.width = barWidth - newWidth;
	//progress over 100
	if (progress >= 100) {
		//stop
		progressBarTimer.stop ();
	}
}
just so you know pre tag with hard returns before and after worked. is that better?
 
Flag Post
Test

test

test

 
Flag Post

Need to test a bit:

Test :D

OKey…
[testing like this]

okay…
testing
even more

Okay.
LEts see how thats looks!

 
Flag Post
Okay
that looked kinda weird :D
Oh, sorry for bumping. I saw this thread before and now I need to test cuz now i need the skkills to do these codeblocks so sorry.<pre>
 
Flag Post

BUMP SO PEOPLE READ THIS!

 
Flag Post
Originally posted by Dynamite_Studios:

BUMP SO PEOPLE READ THIS!

Well with Skyboy posting the link to this thread every time someone doesnt/forget-how-to do this, im pretty sure alot of people are gonna read this :P