I know this post is from 2020, but seeing as how it was never answered (other than just saying “go look at other code” and “tables are too hard”) I thought I’d chip in and explain help how I can, since I’m currently writing my own bbcode plugin, and had to struggle with absolutely no documentation.
I took a look at your [table]
bbcode syntax, and it’s a perfectly reasonable plugin to make, it’s just some wrapping. Seriously, I don’t think sam even looked at the link you sent, because your table bbcode format, is pretty much just the html table format, but with bbcode tags.
This post really helped explain a bit about how to do this.
I don’t have time right now to explain how to do what you want to do (and test it to see if it actually works), so right now I can tell you that the html_raw
and html_block
token types are pretty handy. Also, the best way to figure out if it’s actually working, is by putting in console.log()
in the wrap
function, and then see what you’re actually getting back in the console (and see if what you’re doing is working, without having to worry about discourse’s aggressive sanitizer).