I’m working on a little thing that would require some bbcode, and I really need it to have spoiler tags. I read through the example on adding my own tags to the library, but I don’t really understand how it works. All I want the spoiler tag to do is have a toggle-able button which hides some text.
Share
For bb-ruby it looks like you can send your own tag definitions when you call bbcode_to_html as the first argument… so:
with my_spoiler being:
You’ll need to change the output to what you need and also have javascript to show the spoiler so in jQuery:
I noticed you said you tried bbcoder as well, since I’m the author I’ll post how to do that one too. For bbcoder you need to put something like this in your application initialization or before you start parsing the actual strings:
After you configure BBCoder you are good to go and it will know about the spoiler tag from then on and parse it for you so you just have to do
I haven’t tested these solutions but they should work without much fuss.