KB User's Guide - Embedding Code Snippets in a KB Document

Use the Code sample feature in the TinyMCE editor to add formatted, syntax-highlighted code to a KB document.

Insert a Code Sample

  1. In the KB editor, place your cursor where you want the code snippet to appear.
  2. From the editor menu, select Insert > Code sample....

    Code sample insert option

  3. In the dialog box, select the appropriate programming language from the Language menu.
  4. Enter or paste your code into the code area.
  5. Select Save to insert the code sample into the document.

Edit or Remove a Code Sample

  1. Click anywhere within the existing code sample in the editor.
  2. Select Insert > Code sample... to update the language or code.
  3. Select Save to apply your changes.
  4. To remove the sample, select the code block and use the editor’s Delete or Backspace key.

Available Languages

Select the language that best matches your snippet. Common options include: Bash/Shell, C, C++, C#, CSS, Go, HTML, Java, JavaScript, Markdown, PHP, Python, Ruby, SQL, and XML.

Best Practices

  • Use code samples for commands, configuration files, and programming examples.
  • Select the correct language so the live site can apply appropriate syntax highlighting.
  • Keep snippets focused on the steps or concept being documented.
  • Do not include passwords, API keys, tokens, or other sensitive information.
  • Use normal paragraph text before or after a code sample to explain what the code does and any required changes.

Code samples are displayed as formatted code blocks in the editor and are syntax-highlighted on the live KnowledgeBase site.



Keywords:
formatted syntax-highlighted code sample syntax highlighting languages Bash Shell script C++ csharpCSS HTML Java JavaScript Markdown PHP Python Ruby SQL XML 
Doc ID:
163311
Owned by:
Weizhong W. in KB User's Guide
Created:
2026-08-13
Updated:
2026-08-13
Sites:
KB User's Guide