Skip to main content

Hello! I’ve been having issues using the code block feature when creating an article in the knowledge base. Is there a specific formatting type that I need to use? I have a standard iframe code. 

Hi ​@kmitch

Thanks for reaching out about this. For us to better understand the issue you are facing, could you share more about the specifics of the error that you are seeing or what is not functioning as expected with the code provided within code block (formatting issue, failure to upload, etc.)?

Looking forward to hearing back and assisting further! 

Best,
Justin


@justin Basically nothing happens. If I copy the code and paste it into a code block like this:

Then when I got to preview the page, it still looks like this. 

 

So I’m wondering if there are special formatting requirements in the knowledge base that I need to input around my code. 


Hi ​@kmitch

Thanks for the update. Based on what I see here, all of your content is correctly reflected and published in the preview. Based on some of my own experience with the code block and knowledge base, I believe you may be referring to there being an issue with long horizontal lines of code that seemingly cutoff (please let me know if the issue is otherwise). 

This is all based on the breakpoints of the page and the code block’s max width. To see the full width of the code snippet a user can scroll horizontally. Alternatively, the code could be reduced in width and vertically spaced. You can compare how this may look in the gif below:

 

Hopefully this helps clarify the display of the code block. If there are any other questions, please do not hesitate to reach out!

Best, 
Justin


@justin I might be misunderstanding the use for the code block in the knowledge base, but I assumed it would work just as any other code...enter code, get pretty finalized view. I’m wondering why it’s showing the code rather than the final view when I publish my article? 

 

For example, if this is my code:

 

Why is is not showing this when I publish? 

 

In my knowledge base, I added the code block like this:

 

Then published it and it looks like this:

 


@kmitch We released a change that should fix your issue! Please let us know if it’s still happening for you. Thanks!


@naila_nur it appears to still be happening. :( 


@kmitch oh interesting, could you please try republishing the article and check again? Thanks!


@naila_nur The published article is still showing up like this.

 


@kmitch sorry just to clarify, we released a fix to remove the scrollbar issue for the code block. The code block tool is just for displaying the code itself with syntax highlighting and formatting. We don’t currently support rendering or running custom scripts in the knowledge base article. Hope that helps clarify it!


Reply