← All notes

Quasar

osu! doesn't parse BBCode. It seals it.

osu! doesn't analyse your BBCode. It seals it.

When you save a userpage, osu! runs the text through about twenty regular expressions, one per tag family. Each pass looks for the nearest opening and closing tag and, when it finds them, writes an identifier: [b]Hello[/b] becomes [b:1]Hello[/b:1]. Whatever no pass recognises is not ignored: it is published as written, brackets and all.

That is why two nearly identical pages can look nothing alike. One was sealed, the other wasn't.

The other half of the story
When the page is read, only sealed tags become HTML. That HTML often comes out crossed, and that is where HTMLPurifier steps in: it closes divs by position, moves list items to the nearest open list and normalises every link.

Almost everything osu! does that looks strange is one of those repairs, not a rule of the language.

One measured example

Write this:

[centre][box=a]x[/centre]y[/box]

osu! publishes x inside the box body and y outside the body but inside the wrapper. No balanced tree produces that: the [/centre] closed the innermost div, whichever tag had opened it.

Quasar models that stranded content and paints it where osu! paints it. Not a different parser: the same tree, with osu!'s decisions.

← All notes