I am going to try an attempt at creating my own custom bbcode but appending it to @Antoine extension.
I was going to try an easy one like [fractions] from here:
https://www.phpbb.com/customise/db/bbcode/fraction_bbcode/?sid=baf4a5bef659b9c35955f5063ce49afb
However, my test is not working as I am unable to get Flarum to recognize superscript.
Here is the code I am working with..
<?php namespace AntoineFr\BBCode\FA\Listeners;
use Flarum\Event\ConfigureFormatter;
use Illuminate\Contracts\Events\Dispatcher;
class AddBBCode
{
public function subscribe(Dispatcher $events)
{
$events->listen(ConfigureFormatter::class, [$this, 'addBBCode']);
}
public function addBBCode(ConfigureFormatter $event)
{
$event->configurator->BBCodes->addCustom(
'[FA]{IDENTIFIER}[/FA]',
'<i class="fa fa-fw fa-{IDENTIFIER}"></i>'
);
$event->configurator->BBCodes->addCustom2(
'[fraction]{NUMBER1}, {NUMBER2}[/fraction]',
'<sup>{NUMBER1}</sup>⁄<sub>{NUMBER2}</sub>'
);
}
}
What I am wanting to believe is all I need to do is keep adding those '$event->configurator->BBCodes->addCustom#' for each custom bbcode I add.
This looks interesting:
https://github.com/golonka/BBCodeParser/blob/master/src/BBCodeParser.php
Not sure how to take the sub and sup code from that.