TDX Knowledge: Add Code to Knowledge Articles

In order to show certain details in instructions, editors can insert excerpts of computer code in knowledge base articles. In order to maintain accessibility as well as readability, you should format these excerpts of computer code depending on the audience of the article—it differs between TDX internal articles and public articles.

Note: Adding code using the Formatted option within the Paragraph Format dropdown (where Headings are located) is not supported.

Note for public-facing articles: Code appears as pink text in TDX and black bolded text in Drupal.

Adding Code to the Body of an Article in TDX

  1. In TDX edit mode, highlight the text you want to format as code.

  2. Bold the text
  3. Select the formatting Styles dropdown.
    Formatting Styles dropdown expanded with sections Block Styles and Inline Styles with formatting options.
     
  4. Select Computer Code (under the Inline Styles section).
    Formatting styles dropdown expanded, Inline Styles section. Computer Code highlighted.
     
  5. The resulting text will appear in dark pink with a lighter pink background in TDX and as bolded black text in Drupal. Both with a slightly different typeface from the instruction text. 
    • Example: eyaml encrypt -p
    • Example in TDX: Computer code in dark pink text with light pink background

Note: If drafting code in a Google file such as a Google Doc, the color contrast will not meet accessibility guidelines. However, once the code is added within the TDX article, it will meet accessibility guidelines. 

Last modified

Changed

TDX ID

TDX ID
7541