Skip to content

Rulers: Block and Inline

Alteras1 edited this page Jul 8, 2020 · 3 revisions

So the engine has two main ruler types, Block and Inline (we're just gonna pretend Core doesn't exist). And the way the parser works is annoyingly specific and strict. So first, let us talk about the two and then talk about how they interact.

Block Level

md.block.bbcode.ruler.push()

So the Block level is meant for processing bbcode tags that expect/require blocks. This is your goto for anything that needs nesting. The available methods to it are wrap, replace, before, and after. The limitations to Block level tags are they cannot start/end mid line. Block level arguably gives the most amount of control with it being the only one with access to the before and after methods.

It must be said that using before and after or wrap will allow content inside the tag to be parsed, if token.content is not altered. In regards to Block level tag, This means that block tags can be rendered inside of other block tags.

Inline Level

md.inline.bbcode.ruler.push()

So the Inline level is meant for bbcode tags that fit on a single line or affect text formatting, stuff like bolding, fonts, etc. The available methods are wrap and replace. It will not allow block level tags inside it, so for those wanting to do stuff like mass fonts, make a block level ruler as well.

Order

The order of parsing is Block level, then Inline level.