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 or Edit a knowledge article. 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
-
In the Article body section, place the cursor where you want to insert the code
snippet.
-
Click the insert/edit code sample icon (
) on the HTML toolbar.
-
In the Insert/Edit code sample dialog box, select a markup or programming
language from the Language list.
-
In the text box after the Language list, enter your code.
Alternatively, you can copy the code from an external source and paste
it.
-
Click Ok.
- Optional:
Edit the code by clicking the code snippet, and then clicking the insert/edit
code sample icon (
).