Badge Webflow Award Winner 2023

How to change the preview of a code on Webflow?

Published on 
21/3/2023
-
Amended on 
24/3/2023
Reading time: 5 min
Preview of a Webflow icon with a code snippet in syntax preview
Written by
Florian Bodelot with a T-shirt Digidop

Florian Bodelot

Co-founder

Discover in this tutorial how to use the "Code Highlight" attribute of Finsweet, to easily give a Highlight style to your code snippets on Webflow

Key points to remember

Discover in this tutorial how to use the no-code solution "Attributes - Code Highlight" from Finsweet, to easily give a Highlight style to your code snippets on Webflow.

Why use "Code Highlight"?

If you are a developer or if you publish technical content on your site, you know how important it is to make your code easy to read and understand for your readers. And as a picture is worth a thousand words, I propose you to compare below, two identical code extracts, with for only difference, the addition of a feature - Code Highlight -.

Comparison of a code snippet with and without syntax highlither
Code without syntax highlighter (left) vs code with syntax highlighter (right)

You get it, By using syntax preview on your site, you can make your code more readable and appealing to your readers, which can improve their reading experience and encourage them to stay on your website longer (or come back more often 🤗).

So, how do you add this design customization option to your Webflow site content?

How to use the solution on your Webflow site?

Unfortunately, Webflow does not natively offer to integrate this functionality on the pages of your websites. But... Finsweet attributes do! And in just a few clicks.

→ Using Finsweet Attributes- Code Highlight

  1. Go to the Finsweet "Code Highlight" documentation
  2. Copy the script
  3. Paste the script in the head tag of the page(s) where the codes you want to style are located
  4. Add attribute "fs-codehighlight-element - code"
  5. Choose a theme
  6. Intégrer votre code entre les balises suivantes <!-- fs-richtext-ignore --><pre><code>   YOUR_CODE   </code></pre> (remplacer "YOUR_CODE" par votre code)
  7. Publish your webflow site! 🎉

And there you have it, in no time you have considerably improved the readability of your code snippets ! And as a bonus, this solution works for static elements, or can be integrated directly into dynamic pages (CMS) of your site.

If you prefer, I propose a video tutorial in French, to explain you how to integrate the solution on your website.

Flomodia by Digidop
Coudac project by Digidop
project Heka by DigidopFlaw by project DigidopMorfo project by Digidop