How to use bbCode tags as examples

On a BB I frequent I have been asked to explain the bbCode tags.

I want to write a short guide for them. This will be posted as a sticky.

I want to write something like this:

But obviously without the code tags being broken (I added extra spaces in the text above).

I want to do the equivalent of escaping the escape sequence.

Thanks.

You should be able to use the coded characters & #91; for left square bracket and & #93; for right square bracket. (Again, remove the spaces after the &.)

http://www.w3.org/MarkUp/html-spec/html-spec_13.html

[b**] I think it can be done like this [/b**]

That is: break the tag that you want to be shown by inserting another empty pair of tags within its brackets.

You want to show the bold tag, so you type this:

[b[i][/i]]

Which is rendered as this:

[b**]

Thanks Mangetout that works.

Just use [noparse][noparse]text here[/noparse][/noparse].

e.g. [noparse]this is an example of sentence inside a [noparse] tag, which should have been bold but isn’t[/noparse].

Other examples:
[noparse]no italics[/noparse]
[noparse]www.google.com [/noparse]
[noparse]

[/noparse]

Just to update - on the board I’m using (phpbb based)

Mangetout’s suggestion works for [​b] but not for [​img]. I guess this is because of the order they are interpreted.

Also once I do a preview post. All the empty [​i][/​i] tags are helpfully removed. Grr.

xash’s [​noparse] seems to not be implemented.

I finaly ‘fixed it’ using a zerowidthspace unicode U+200B within the tag to break it.

It also works here on the dope as I’ve used it whilst posting this reply.

:smack: Oh well.

Mind you… that does give me an interesting idea… a series of experimental posts should be able to determine the exact order in which vB tags are parsed on the SDMB. What I will do with such information is at present unclear.

Nefarious purposes ?

You can proceed to eat it.

Actually, some of the tag order precendence is down to the browser (although only with intact tags) - as discussed in this thread:

I’m not familiar with phpbb’s characteristics, but most message board software includes the “code” tag for just this purpose – it sets a quote-like block within which coding is not parsed, so that one can show how to encode examples, which are usually then duplicated outside the code tag to show what effect they have.

Like this:


Use the **text to be bolded** tags to make a snippet of text bold.

Which becomes:

Use the text to be bolded tags to make a snippet of text bold.

ETA: Well, that was interesting. Any idea, xash, why it didn’t work?

To me, your brackets appear to have a full-sized space in them. (Opera 10.10 on Windows Vista.) (It does look correct in IE 8.0.6 on my machine, though.)

That’s not the purpose of the code tag.

The code tag is used for displaying programming code, and retains indentation and spaces, and uses a non-proportional font (great for ASCII art):


<?
$check = "test";
$check .= $filename;
if ($test == $check)
{
print("<HTML><BODY>You have already voted. Thank you.</BODY></HTML>");
}
else
{
$rated = "test";
$rated .= $filename;
setcookie(test, $rated, time()+86400);
print("<HTML><BODY><br>You haven't voted before so I recorded your vote</BODY></HTML>");
}
?>

or the php tag:


<?
$check = "test";
$check .= $filename;
if ($test == $check)
{
print("<HTML><BODY>You have already voted. Thank you.</BODY></HTML>");
}
else
{
$rated = "test";
$rated .= $filename;
setcookie(test, $rated, time()+86400);
print("<HTML><BODY><br>You haven't voted before so I recorded your vote</BODY></HTML>");
}
?>

Deflagration, maybe this will help you. It explains each code, with examples: