Combining boxcode

Tags must be nested in the correct order: [b][u]bold underline[/u][/b] is valid but [b][u]broken[/b][/u] is not.

The same tag cannot be nested. For example, [class=one][class=two]some text[/class][/class] will not work. To get the intended behaviour in this case, you could have a combined class instead: [class=onetwo]some text[/class].

The no-attribute form of [url] (e.g. without link text), and both forms of the [img] tag, must be the innermost element in any nested sequence.

Styling boxcode

Boxcode is translated internally to HTML. You can thus affect the presentation of boxcode by editing your CSS. For example, to change the presentation of the [s] tag:

s {
text-decoration: none; /* reset default */
opacity: 0.2;
}

[class] parameters must start with a letter, and are limited to 20 alphanumeric characters. [class=blink] is valid but [class=2] is not.

The [class] boxcode is intended for open-ended styling. It produces a span with no default CSS. You can create a corresponding class using a cc_ prefix. For example, for blurred text, copy this to your CSS:

.cc_blur {
text-shadow: #000 0 0 0.5em;
color: transparent;
}

Now users can blur the text in their messages: [class=blur]this will be blurred![/class].

At its simplest, the Custom filter is a list of words that you want hidden or replaced in your Cbox. Enter words, one per line, and if a user's name or message contains that word, it will be filtered out.

badword
badderword:betterword

When a message is applied to the above filter, "badword" will be turned into asterisks, and "badderword" will be replaced by "betterword". The ":" (colon) character separates the pattern text from the replacement text. If the colon is left out, the entire line is the word to match.

Filters can be useful for more interesting things too, however.

Styling and aliasing names

You can set colours for admins, mods and registered users on your Themes page, but you can create individualized filters for particular names or words you want to highlight.

jacob:[color=green]TheRealJacob[/color]

This user would still enter "jacob" as his name in your Cbox, but whenever he posts, or whenever someone mentions him in a message, the output will be TheRealJacob, in green.

If you want to apply style besides colour to names, you can use the [class] boxcode.

Using and disabling boxcode

Boxcode itself can be customised, making the combination of filtering and formatting very powerful. See more.

Your custom filtering rules support boxcode, as seen in the example above, even if you have boxcode disabled for messages in your Settings. You can also match the boxcode that people use (or attempt to use) in their messages.

The first rule will match "[br]" appearing in messages, and replace it with a slash. But the [br]s that appear in the second rule will still work, creating line breaks, because each replacement string is boxcode-filtered independently.

If boxcode is enabled for messages, then you can create aliases and compound boxcode using partial (open) tags:

![red]:[color=#f00][b]
![/red]:[/b][/color]

When a user enters [red]this is red[/red], the filter translates this to [color=#f00][b]this is red[/b][/color], which is now valid boxcode, and will in turn become HTML.

Tip: If a rule isn't matching when it should, try putting ! at the start of the line. If a rule is matching when it shouldn't, try putting ~ at the start of the line.

Filter modes

By default, filter rules are matched anywhere that the search text is not surrounded by other letters. Starting a line with the prefix "!" (exclamation mark) makes the rule a simple substring filter instead. Such rules are stronger in the sense that they will match in more contexts. However, unintended substitution is also more likely.

By contrast, a rule that begins with "~" (tilde) is only matched when preceded by space and followed by space or punctuation. This is similar to how emoticon substitution works. Such rules are looser in the sense that they are only matched in this specific form. Unintended substitution is less likely, but the rule may not be triggered as easily as desired.

fred:Fred
!color:colour
~plane:✈

In this example, the first rule will match the "fred" in "@fred" and "(fred)", but not in "freddy" or "alfred". The second rule will match "color" as well as "colorful" (substituting "colour" and "colourful" respectively). The third rule matches only "plane" by itself or followed by punctuation.

Filter order

Names and messages are filtered first by your custom rules. Messages are then parsed for smilies, boxcode, and links, in that order, if you have these features enabled. Names do not have these built-in filters applied.

Within your custom filter itself, the order of rule-matching is from top to bottom.

hi:hello
hello:goodbye

If a user posts "hi!", then as the message passes through the above rules it will be translated first to "hello!", and then, because it now matches the second rule, it becomes "goodbye!". In general, whenever a rule matches something that appears in another rule's replacement text, the order matters, and earlier rules can influence the effect of later ones. It's not recommended to depend on this behaviour, however. To create internal shortcuts, use variables.

Variables

A line beginning with a "$" (dollar sign) defines a variable that you can use in subsequent replacement text:

The first two lines do not match any name or message text; they define variables representing the strings following the colon. Variables are written in to the replacement string by surrounding them with braces. Variables in replacement text are expanded before filtering itself is applied to messages. The variable $0 is special: it contains the text that matched.