Admin Forum:How to prevent the insertion of p- and span-tags?

I like wikicode. I really do. It's great. But.

For the past hour or two I've been trying to throw together a template that allows wikicode but prevents the wikicode parser from inserting all kinds of useless and unwanted p- and span-tags. The "creative" interpretation of the whitespace in my wikicode is starting to get on my nerves.

(What I'm trying to create is a div with two columns of links in it btw)

Can that be done? Can you have wiki links (and wiki headers etc.) but still complete control over the whitespace? -- Pecoes 20:20, March 1, 2012 (UTC)


 * I did find a hack. I neutralized the unwanted markup with:


 * and handled the whitespace by throwing around with &lt;br /&gt;s like nobody's business.


 * That seems to have worked. Still: If someone knows how to take control of the whitespace without resorting to hacks, please, do tell me! -- Pecoes 21:29, March 1, 2012 (UTC)


 * I'm not sure what you mean by creative interpretation of whitespace. You'd have to provide an example of what specific bad effects you are refering to. If your problem is with the rich text editor adding extraneous html tags (such as the strings of  removed in this edit), you could use the AbuseFilter extension to prohibit edits that contain those kinds of errors.
 * If you want a two-column list of links for a "See also" section, you could use something like the wikipedia:Template:Column-count, which uses the CSS3 "column-count" property. That way you wouldn't need separate parameters for each side, and your left and right list of links would automatically have balanced lengths. The only downside is that it doesn't work in all browsers. --Gardimuer { ʈalk } 18:38, March 3, 2012 (UTC)

Here's an example:

Now check out the source code of the result:

one two three four five six

Pecoes 18:52, March 3, 2012 (UTC)


 * I see what you mean. That is troublesome. --Gardimuer { ʈalk } 23:49, March 3, 2012 (UTC)


 * In an ideal world there would be a really simple solution to this:



working link




 * but that tag doesn't seem to exist. -- Pecoes 00:57, March 4, 2012 (UTC)


 * All new lines are treated as being a new paragraph. For your example above, you should use a  tag for each new line of the div, or start the first line on the next line after starting the div.

An example here. Second line. Third. Notice no  blocks.

Second example.

This time I use line breaks instead.

This time, all lines are treated equally with  blocks.
 * Rappy 01:01, March 4, 2012 (UTC)


 * It's not unpredictable. I give you that. And it's true that you can suppress the insertion of paragraph tags with break tags. But that's an abuse of the break tag, isn't it? Shouldn't there be a tag that allows you to use whitespace as you see fit? That's what the pre tag does in HTML. But the pre tag in wikicode is a completely different beast. It leaves the line breaks intact, yes, but it also does what the nowiki tag does. And as if that wasn't too much already the pre tag also formats the output - badly of course. The wikicode pre tag is a bad idea gone horribly wrong. And because of that we have to do dumb bs like inserting lots and lots of break tags to trick the engine into emulating the HTML pre tag. -- Pecoes 01:55, March 4, 2012 (UTC)


 * The alternative is to do a log of "dumb bs" to get general wiki-code formatting. Have you tested this on Wikipedia too? I believe this is a 'fault' in MediaWiki's software interpreting what you are doing rather than Wikia's interpretation of the code. Rappy 02:19, March 4, 2012 (UTC)


 * No. I haven't tested the pre tag on Wikipedia. Would it make a difference if I found the same problem over there?


 * Sorry for the rant in my previous post btw. I'm not looking for someone to blame. I'm only interested in a solution. -- Pecoes 03:05, March 4, 2012 (UTC)

Depends on what you're trying to do as to a possible solution. Maybe give a link to what you're wanting to avoid? Re: Wikipedia... if it gives the same output at Wikipedia, it's something the MediaWiki software is doing and has nothing to do with changes Wikia has made. If it doesn't, it may have been fixed/addressed in their upgrades from MediaWiki 1.16.5 -> 1.18.1. Rappy 06:50, March 4, 2012 (UTC

Researching the issue over at mediawiki.org was good advice, Rappy! I did find something very useful at MetaWikiMedia:Help:Newlines_and_spaces. Look at this:

one two Wow! four five

which renders as:

one two Wow! four five

Wow! A poetry extension! Who would have thought? Awesome! :) -- Pecoes 08:46, March 4, 2012 (UTC)


 * Hah. I forgot about that one. It's rarely used by anyone these days. Rappy 19:48, March 4, 2012 (UTC)