• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

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: 48
P

Pabblymember11

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