Services Plugins FAQs

📰 BBcode to HTML Convertor - New Plugin from Zeroqode

This simple but powerful plugin helps you convert BBcode to HTML and vice versa. It can convert Rich text editor value to HTML, which is useful for sending emails. In addition, it supports tags for images, videos, and tables.

BBCode_to_HTML

Life demo: https://zeroqode-demo-23.bubbleapps.io/bbcode_to_html_converter

DEMO & DOCUMENTATION
BBcode to HTML converter | Plugin for Bubble by Zeroqode

SUPERCHARGE YOUR APP WITH ZEROQODE PLUGINS
No-Code App Plugins for Bubble | Zeroqode

Anastasija Volozaninova
Executive Assistant @ Zeroqode
#1 Bubble Publisher and Developer

logo-icon-S-circle

:file_folder: 130+ Bubble Templates
:mortar_board: 25+ Bubble Courses
:gear: 300+ Bubble Plugins
:iphone: Convert Bubble app to iOS & Android
:man_technologist:t4: No-code Development Services

For anyone looking at this, I was looking to buy this plugin until I tested it on the company’s demo page to find that it doesn’t really work (specifically in the area of HTML to BBCode). I logged a ticket here and got an initial response (telling me it worked fine) then sent the proof that it doesn’t and then, of course, received crickets.

Just so you know, you can make a simple version of this by executing some javascript in Bubble that does a pretty decent job of search and replace for the tags. If you as OpenAI to write you the code it can. It takes a little time but I no longer need the plugin.

Hello @sanastasi,

I apologize for the delay in my previous response. I have already addressed your question in the previous thread, so I recommend continuing our communication there to avoid any confusion in the future.

Thank you for your understanding, and if you have any more questions or need further assistance, please feel free to reach out :hugs:

Wishing you a great day ahead :star2:

So the reply here was that the plugin does not handle complex HTML and that Zeroqode does not want to update it so that it does. This is ironic given that the javascript to build something that performs better than the current plugin (including handling complex HTML simply by ignoring it) is 40 lines long. Here is the code if anyone needs it. To use it you need to clear a few tags prior to passing the text to the javascript.

** I need to add in the paragraph breaks into the string before I pass it to javascript as Bubble won’t allow you to do that. Hence, I add lines with a find and replace for


and . The rest is taken care of by the javascript. I’ve accounted for styles by replacing h1 through h3 only with BBCode sizes 7, 6 and 5 respectively.

The rest of it is ignored because Bubble can’t pass it into a PDF generator anyway. I’ve asked PDF Conjurer to look at including table tags. The code to keep tables is in the javascript but I’ve edited it out and kept a holistic replace.

We use this output to as a way to ingest information into our AI model so that is what it was built for and to works perfectly fine. Not too complicated at all.

You can actually simplify this with a match case like I have at the end so you could easily reduce this to even less lines of code. This translates large HTML files in milliseconds but I agree that it could be faster.

I’m using the JS2Bubble plugin to run the javascript. There is a great Youtube video on how to do it.

var html = properties.param1;

    // Remove <span> tags and their attributes
    html = html.replace(/<div[^>]*>/gi, "").replace(/<\/div>/gi, "");
    html = html.replace(/<figure[^>]*>/gi, "").replace(/<\/figure>/gi, "");
    html = html.replace(/<span[^>]*>/gi, "").replace(/<\/span>/gi, "");
    html = html.replace(/<iframe[^>]*>.*?<\/iframe>/gi,"");
    html = html.replace(/<pre[^>]*>/gi, "").replace(/<\/pre>/gi, "");

    // Bold, Italic, Underline
    html = html.replace(/<b>/gi, "[b]").replace(/<\/b>/gi, "[/b]");
    html = html.replace(/<i>/gi, "[i]").replace(/<\/i>/gi, "[/i]");
    html = html.replace(/<u>/gi, "[u]").replace(/<\/u>/gi, "[/u]");
    html = html.replace(/<strong>/gi, "[b]").replace(/<\/strong>/gi, "[/b]");
    html = html.replace(/<em>/gi, "[b]").replace(/<\/em>/gi, "[/b]");

    // Headings with specific sizes, removing style attributes
    html = html.replace(/<h1[^>]*>/gi, "[center][size=6]").replace(/<\/h1>/gi, "[/size][/center]");
    html = html.replace(/<h2[^>]*>/gi, "[center][size=5]").replace(/<\/h2>/gi, "[/size][/center]");
    html = html.replace(/<h3[^>]*>/gi, "[center][size=4]").replace(/<\/h3>/gi, "[/size][/center]");

    // Correctly handle <a href> tags
    html = html.replace(/<a[^>]+href="([^"]+)"[^>]*>(.*?)<\/a>/gi, "[url=$1]$2[/url]");

    // Images
    // html = html.replace(/<img src="(.+?)"( alt="(.+?)")?>/gi, "[img]$1[/img]");
    html = html.replace(/<img[^>]*>.*?<\/img>/gi,"");
    html = html.replace(/<img [^>]*>/gi, "");

    // Lists (unordered and ordered)
    html = html.replace(/<ul>/gi, "[list]").replace(/<\/ul>/gi, "[/list]");
    html = html.replace(/<ol>/gi, "[list]").replace(/<\/ol>/gi, "[/list]");
    html = html.replace(/<li>/gi, "[li]").replace(/<\/li>/gi, "[/li]");

    // Line Breaks and Paragraphs
    html = html.replace(/<br>/gi, "\n");
    html = html.replace(/<p[^>]*>/gi, "").replace(/<\/p>/gi, "\n");
   

    // Quotes
    html = html.replace(/<blockquote>/gi, "[quote]").replace(/<\/blockquote>/gi, "[/quote]");

    // Strikethrough
    html = html.replace(/<s>/gi, "[s]").replace(/<\/s>/gi, "[/s]");

    // Tables Keep
//    html = html.replace(/<table[^>]*>/gi, "[table]").replace(/<\/table>/gi, "[/table]");
//    html = html.replace(/<tr[^>]*>/gi, "[tr]").replace(/<\/tr>/gi, "[/tr]");
//    html = html.replace(/<th[^>]*>/gi, "[th]").replace(/<\/th>/gi, "[/th]");
//    html = html.replace(/<thead[^>]*>/gi, "").replace(/<\/thead>/gi, "");
//    html = html.replace(/<td[^>]*>/gi, "[td]").replace(/<\/td>/gi, "[/td]");
//    html = html.replace(/<tbody[^>]*>/gi, "").replace(/<\/tbody>/gi, "");

// Tables Remove
    html = html.replace(/<table[^>]*>/gi, "").replace(/<\/table>/gi, "");
    html = html.replace(/<tr[^>]*>/gi, "").replace(/<\/tr>/gi, "");
    html = html.replace(/<th[^>]*>/gi, "").replace(/<\/th>/gi, "");
    html = html.replace(/<thead[^>]*>/gi, "").replace(/<\/thead>/gi, "");
    html = html.replace(/<td[^>]*>/gi, "").replace(/<\/td>/gi, "");
    html = html.replace(/<tbody[^>]*>/gi, "").replace(/<\/tbody>/gi, "");

//HTML character substitutions
 const specialChars = {
        '&lt;': '<',
        '&gt;': '>',
        '&amp;': '&',
        '&quot;': '"',
        '&#39;': "'",
        '&nbsp;' : ' '
    };

html=html.replace(/&lt;|&gt;|&amp;|&quot;|&#39;|&nbsp;/g, (match) => specialChars[match]);

console.log(html);
bubble_fn_convert(html);



Hi @sanastasi,

We appreciate you sharing this information, which could be valuable for other users facing a similar issue. I’ve forwarded your post to our developer to assess the feasibility of implementing it into our code. I’ll keep you updated with any developments from the developer’s side.

Wishing you a fantastic holiday season! :hugs: