Streaming live at 10am (PST)

Code formatting in CMS editor

Hi, just implemented CMS on my website to add a blog to it and am loving every aspect of it. The only issue I ran into is to include code styled text into the blog posts.

Since I’m using a rich text field for the post content manually importing the html using an import block is out of question.

I found a workaround by editing the styles for h6 tags to make them “look” like code styled text, but without the use of pre tags the styling still looks odd.

It would be awesome if the rich text field could support either “code” style or include markdown support.


If you could share your published URL, I can suggest a custom JavaScript code to wrap your h6 with pre tags.

Thanks @samliew! Here you can find where I got so far:

This is the code needed to wrap all h6 with pre

var Webflow = Webflow || [];
    var cWrap=$('<pre />');
        var o = $(this).next('h6').length;
        if (!o) cWrap=$('<pre />');

Then you need to insert custom styles for the pre:

pre {
  background: #4d4d4d;
.blog-post-inner-content pre h6 {
  overflow: initial;

I tried your code. While it does indeed wrap the h6’s in pre tags while maintaining the style, the spacing for the code still gets lost along the way (my main purpose with this was to avoid that issue), any idea on a workaround for that?