Showing code blocks on knowledge base articles

We have a knowledge base that features multiple articles with code blocks in them.

However, these code blocks are displayed as texts in gray boxes and nothing else. Can we render them so that our customers can easily copy and paste them into their own code?

I see that HubSpot’s own Developer site has a way to do this: Fetching data for UI extensions - HubSpot docs

Hey, @aabendan :waving_hand: Great question. The answer is — yes, but partially. The Knowledge Base editor has a “code format” tool in the toolbar. But it’s not at the same level of robustness as what you see in the dev docs. Meaning you can add code samples, but it lacks the formatting and the nice “copy + paste” option for folks to use with your samples.

Example:

My quick test

It took a little tweaking to get the line breaks and indentation to look decent, but it’s doable.

If you have a moment, I think adding this to the Ideas forum as a feature request would be helpful. I can definitely see the use case for having a more complete code block tool available for Knowledge Base pages.

I hope this is helpful.

Talk soon! — Jaycee