The Syntax Highlighter Element is our solution to allow you to provide code snippets in a variety of different languages in a copyable, embeddable format directly on your website. Aside from the 4 pre-set style options, it comes with several customization options to control all colours, borders, text, line wrapping, code copying and more.. Read below for an overview of the specific features of the Element.
Step 1 – Create a new page or edit an existing one.
Step 2 – Add a container then select your desired column layout.
Step 3 – Click the ‘+ Element’ button to bring up the Elements window. Locate the ‘Syntax Highlighter’ element and click it to bring up its options window.
Step 4 – To view the possibilities of this element, make sure you visit the Element Demo page. The element has two tabs; General and Design. On the General tab, the first thing to do is to insert the code you wish to highlight. Directly below that, you can choose from any of the 4 preset style options for the snippet. Then select the coding language that the snippet is in (this assists with correct styling). There are also a number of options to show or hide line numbers and to add the ability for the user to copy the code to the clipboard. The Design tab offers a number of styling options to further customize the element.
Step 5 – Once you have finished configuring the options, click ‘Save’ to insert the element into the page. Preview the page to view the code snippet, and remember you can come back into the element to fine tune it.
You can deploy as many individual Elements in pages and posts as you need, there is no limit. Within each of the Elements, you will see a tab or tabs that house an array of options that make it possible for you to configure each Element independently, and greatly enhance your flexibility and creative options.
Note: The Default setting will use the global settings assigned for this element in your Theme Options > Fusion Builder Elements > Syntax Highlighter Element section.
Code to Highlight – Enter some code to be displayed with highlighted syntax. IMPORTANT: Please make sure that the “Code Block Encoding” setting in Theme Options is enabled in order for the code to appear correctly on the frontend.
Highlighter Theme – Select which theme you want to use for code highlighting. Choose from Default, Light 1, Light 2, Dark 1, and Dark 2.
Line Numbers – Choose if you want to display or hide line numbers.
Line Wrapping – Controls whether the long line should break or add horizontal scroll.
Copy to Clipboard – Choose if you want to allow your visitors to easily copy your code with a click of the button.
Copy to Clipboard Text – Enter text to be displayed for the user to click to copy. Leave empty for the default value of Copy to Clipboard.
Element Visibility – Allows you to control the Separator’s visibility. Choose one or more between Small Screen, Medium Screen, or Large Screen.
CSS Class – Allows you to add a class name to the wrapping HTML element. The class name does not have to be unique, but all areas with the same name will reflect any changes made to the class.
CSS ID – Allows you to add an ID to the wrapping HTML element. The ID must be unique to each CSS ID.