How To Display Formatted Code Blocks Using Your Sitefinity RadEditors

For all those developers out there that want to display code on their Sitefinity web site, check out the Format Code Block tool for the RadEditor.  This handy tool allows you to easily paste a chunk of code on your site with ease.

Steps To Enable The Format Code Block Tool

  1. Go to Administration > Settings and then select “Text area” from the menu on the left.
    1. If you have the multi-site module enabled, you will need to click the “Global settings” link after navigating to Administration > Settings.
      Sitefinity Text Editor Settings
  2. Click the EDIT button for the “Default tool set”.  See the yellow highlighted link below.
  3. Insert the following code <tool name=”FormatCodeBlock” /> after the “FormatBlock” xml node.  See the XML highlighted in yellow below.
    Sitefinity add format code block
  4. Click the SAVE button.

You will now see the following tool added to your RadEditors.  Click this icon to open the format code block editor.

Sitefinity format code block button

 

Below is an example of the format code block editor.  Simply paste your code in the text area at the top, select a language, click preview, and then click OK once you are ready to paste the code block.

Sitefinity format code block editor

 

Now you can quickly and easily add formatted code to any of your content in seconds.  Enjoy.

Comments