--- title: Format a code snippet automatically in knowledge articles description: Add syntax highlighting to a code snippet in knowledge articles using the HTML editor. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/servicenow-platform/knowledge-management/insert-code-html-editor.html release: australia product: Knowledge Management classification: knowledge-management topic_type: task last_updated: "2026-03-12" reading_time_minutes: 1 breadcrumb: [Editing functions for knowledge articles in the HTML editor, Creating and maintaining articles, Knowledge Management, Manage content capabilities, Extend ServiceNow AI Platform capabilities] --- # Format a code snippet automatically in knowledge articles Add syntax highlighting to a code snippet in knowledge articles using the HTML editor. ## Before you begin Open the knowledge article in which you want to use the HTML editor. Role required: knowledge ## About this task You can also use the HTML editor when creating or editing a knowledge article using the Knowledge Management application in the ServiceNow AI Platform interface or in Agent Workspace. To create or edit a knowledge article in the ServiceNow AI Platform interface, see [Create a knowledge article](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/knowledge-management/create-knowledge-article.md) or [Edit a knowledge article](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/knowledge-management/edit-knowledge-article.md). To create or edit a knowledge article in Agent Workspace, see [Create a knowledge article in Agent Workspace]() or [Edit a knowledge article in Agent Workspace](). ## Procedure 1. In the Article body section, place the cursor where you want to insert the code snippet. 2. Click the insert/edit code sample icon on the HTML toolbar. 3. In the Insert/Edit code sample dialog box, select a markup or programming language from the Language list. 4. In the text box after the Language list, enter your code. Alternatively, you can copy the code from an external source and paste it. 5. Click **OK**. 6. Edit the code by clicking the code snippet, and then clicking the insert/edit code sample icon .