Closed mark8044 closed 2 years ago
This is an interesting suggestion. In practice this may seem easy to implement because it's pretty much the same syntax and structure as basic HTML. However we use an external library to help us parse the HTML into a readable tree, and it doesn't support BBCode at the moment. There is this library: https://pub.dev/packages/bbob_dart but we cannot use it because it does not have nullsafety support (and probably won't since it hasn't been updated in quite some time).
Maybe something very basic could be possible? I don't want to implement a buggy feature though... Parsing these tree structures is very, very error prone.
Side note: If your BBCode is very simple why don't you load the string and replace the [
and ]
with <
and >
? Again, that would only really work for the simple stuff like bold, italic, underline, etc. We could also try and use that approach to feed it into our HTML parser and then detect BBCode specific elements like link
or image
, and convert those to actual HTML elements.
There's also https://pub.dev/packages/flutter_bbcode which support bbcode and its specific tags already. I'd prefer not to include this feature.
Yeah, this is definitely outside the scope of this project, sorry.
As a workaround you could convert the BBCode string into HTML as @tneotia mentioned, which shouldn't be terribly difficult.
BBCode is used on a large number of bulletin board systems as an alternative form of markup language.
BBCode follows a tag structure that is often translated to HTML for rendering on a browser.
This could be an interesting addition to add even more versatility to this package