• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

    🚀 Exclusive Lifetime Offers 🚀

    We invite you to take advantage of our special one-time payment plans, providing lifetime access to select applications:

    • 🔥 Pabbly Connect — Lifetime Access for $249View Offer
    • 🔥 Pabbly Subscription Billing — Lifetime Access for $249View Offer
    • 🔥 Pabbly Chatflow — Lifetime Access for $249View Offer

    Make a one-time investment and enjoy the advantages of robust business management tools for years to come.

Code block not returning HTML code

PatFriedl

Member
I'm using a JavaScript code block to do some HTML formatting of some text, but when I try to use the output, all HTML is stripped or missing from the output. I'm also seeing that any HTML in the code block is being rendered as HTML, so that may be a problem as well.

Is there a way to force the output to stay formatted with HTML tags in place?
 
P

Pabblymember11

Guest
Hey @PatFriedl

Can you please share the workflow in which you have tried the same so that we can look into it and help you accordingly?
 
P

Pabblymember11

Guest
Hey @PatFriedl

To integrate HTML content into a JavaScript Code action step, you might consider encapsulating the codes within JSON format. This approach helps in the seamless transfer and execution of the HTML content within the JavaScript environment, ensuring compatibility and smooth functionality within your workflow.
 

PatFriedl

Member
I'm not sure how that helps with future steps where I need to insert the converted markdown into email. Can you give me an example? And is there a reason why the textbox for code formats/processes HTML so it breaks the code?
 
P

Pabblymember11

Guest
Hey @PatFriedl

Can you please share the JS code you are trying to execute with us once so that we can look into it?
 

PatFriedl

Member
Here's the code:
function convertMarkdownToHTML(markdown) {
let htmlContent = markdown.replaceAll('![image](', '<img src="')
htmlContent = htmlContent.replaceAll('.png)', '.png" style="max-width:750px;width:100%;height:auto;">');
htmlContent = htmlContent.replaceAll('**','');
htmlContent = htmlContent.replaceAll('\n','<br>');
return htmlContent;
}
var rssContent = 'markdown content here';
var output = convertMarkdownToHTML(rssContent);
return output;

It manages to convert the "\n" and strip the "**" markdown, but fails on the image tag replacement for some reason. Then any time you open the code block after saving, Pabbly formats the code as HTML, so the <br> and image tag HTML break the code.
 

Attachments

  • markdown-conversion.png
    markdown-conversion.png
    42.1 KB · Views: 95
P

Pabblymember11

Guest
Thanks for the update and let us know if you need any further help.
 
Top