I have a Collection of Articles and within an article, I have a Rich Text element, which includes technical documentation text. Is there a way to include a code block/preformatted text into it? So far, I only have the option to add text formatting, Headings, and Quotes.
I’ve included a link to the documentation page below. We’re trying to get the JSON code into code blocks, but currently have them in Quote blocks.
I first designed my fake <pre> style in Webflow and grabbed the generated CSS with Chrome Inspector, then used it for my custom code. Paste the code in a custom code box at site level or at page level for the post template.
You won’t see the text as pre in forms in the designer CMS part or in the form of the editor, but if you edit your post inline in the editor it will show the style as you type. Just keep your code within a paragraph and it works. If you need to skip lines, do a shift+Enter instead of Enter.
Thank you for the quick response, but this particular fix looks like we would need to structure every item in the collection to display code/preformatted text in the same “outline/structure”, so I submitted a Wishlist topic request, as it feels like code blocks and tables throughout Collection Item text can be considered basic CMS functionality.
Thanks for the video @vincent–does that apply to the whole page template?
My difficulty is that I want to use the same page template for all our technical documentation (for consistent look/feel), but each article in the collection will have code blocks/preformatted code in different spots, as each article covers a different aspect of the product.
I guess the best example would be this Google technical documentation, where each article will look/feel the same, but the code blocks can be spread out in different places:
In their documentation site, Quickstart and ‘Authenticating to the API’ look & feel the same, but the appearance of code snippets will be in very different places
This is my current template that we purchased through Webflow–so we have a Collection Item, which contains a Rich Text element (above the video wrapper), where all the text, random code snippets should essentially be going: