MegaDrive Wiki:Editing Tips
This page contains various guidelines you should follow when writing or editing pages to make everyone's life easier, as well as some tricks and tips you may wish to take into account.
If you embed code into a page for whatever reason, there are several ways for you to do this, however, it is important to note that simply shoving the code in the WikiText will ruin spacing, due to the fact that this wiki uses a variable-width font, which doesn't make code look very good. Instead, you should use one of the various mechanisms provided by the wiki to render code with a fixed-width font.
The first option is to simply use a <pre> tag, which is simply a HTML tag the wiki software doesn't alter. This tag simply indicates to the browser that the content it's wrapping is pre-processed (hence the name) and can simply be outputted without applying much styling. The wiki's stylesheets ensure that any content inside a pre tag uses a fixed-width font, with a distinct background colour and border to visibly separate it from the rest of the text. Due to this, nearly anything that relies (or looks better with) a fixed-width font can be displayed correctly. For example, ASCII art can be displayed this way:
___ ___ ___ ___ /\ \ /\ \ /\ \ /\ \ \:\ \ /::\ \ /::\ \ \:\ \ \:\ \ /:/\:\ \ /:/\ \ \ \:\ \ /::\ \ /::\~\:\ \ _\:\~\ \ \ /::\ \ /:/\:\__\ /:/\:\ \:\__\ /\ \:\ \ \__\ /:/\:\__\ /:/ \/__/ \:\~\:\ \/__/ \:\ \:\ \/__/ /:/ \/__/ /:/ / \:\ \:\__\ \:\ \:\__\ /:/ / \/__/ \:\ \/__/ \:\/:/ / \/__/ \:\__\ \::/ / \/__/ \/__/
A second option available for displaying code on pages is to use the <source> tag, which is parsed internally by the wiki software and converted to syntax-highlighted code with optional line numbering. There is support for several different languages to be syntax highlighted, including:
- C++ (cpp)
- Generic Assembly (asm)
- Motorola 68k Assembly (m68k)
- Verilog (verilog)
- VHDL (vhdl)
- Z80 Assembly (z80)
If you embed any sort of code that is in one of those languages, you should use the <source> tag. The language is specified by using the "lang" attribute on the tag:
<source lang="asm"> If line numbers are desired, the tag should look something like this:
<source lang="asm" line="GESHI_FANCY_LINE_NUMBERS">
This is how syntax-highlighted Motorola 68k assembly looks like when using this tag:
<source lang="m68k" line="GESHI_FANCY_LINE_NUMBERS"> SetUpJoypads: move sr, -(sp) ; Back up status move #$2700, sr ; Disable all ints
move.w #$100, $A11100 ; Stop Z80
@waitZ80: btst #0, $A11101 ; Has the Z80 stopped? bne.s @waitZ80 ; If not, wait.
moveq #$40, d0 ; PD6 is an output move.b d0, $A10009 ; Configure port A move.b d0, $A1000B ; Configure port B move.b d0, $A1000D ; Configure port C
move.w #0, $A11100 ; Restart the Z80 move (sp)+, sr ; Re-enable ints rts </source>