Last Updated on June 1, 2022 by Rakesh Gupta
Now it is possible to add code samples to posts when the rich text editor is enabled in Chatter Answers and Ideas, and the code will display in the proper format.
Enable Rich Text Editor for Chatter Answers
To configure it for ideas, follow the below steps in Salesforce Classic:
- Click on Name | Setup | Build | Customize | Chatter Answers | Chatter Answers Settings
- Click Edit
- Select Enable Rich Text Editor checkbox
- Click Save.
Proof of Concept
To test this feature, follow the below steps
- Navigate to the Idea tab, and click on any idea. It will drill down you to an idea detail page
- Here you can paste the sample code ( I will show you the first old output then you will come to know the difference between both).
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World”);
}
} - Paste the sample code and click on Post.
- Now, we will try a new feature first copy a code sample from any text editor and click on
button to open the Add a code sample text box. Similar to the below screenshot
- Click on OK, then click on Post. The code sample appears in the body of the post with its formatting intact.
- Below image shows the difference between the old and new method

Formative Assessment:
I want to hear from you!
What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.