Format a code snippet automatically in knowledge articles

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 2분
  • Add syntax highlighting to a code snippet in knowledge articles using the HTML editor.

    시작하기 전에

    Open the knowledge article in which you want to use the HTML editor.

    Role required: knowledge

    이 태스크 정보

    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.

    프로시저

    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 (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 (Insert/Edit code sample icon).