How to Use WPS Insert Code Block on macOS

Last updated:July 23, 2026

Use Insert Code Block with 3 how-to topics, including inserting from the ribbon, inserting with slash commands, and adjusting code block settings; choose a topic from the index and follow the steps.

How-to Index

How-to Guide

1. Insert a code block from the ribbon

Entry path: Insert > Code Block

  1. Place the cursor where you want to insert the code block.
  2. Click the Insert tab at the top of the window.
  3. Select Code Block.
  4. Type or paste your code into the inserted block.

Success Criteria

  • Interface result: A separate code block appears in the document.
  • Next action available: You can continue typing, pasting, or editing code inside the block.

Tips While Using

  • Common mistake: If the cursor is not placed first, the code block may be inserted at the current default editing position.
  • Environment note: You need to be in an editable smart document.

2. Insert a code block with slash commands

Entry path: Paragraph input > / > Code Block

  1. Type / in a paragraph to open the quick menu.
  2. Type 代码块 or code to narrow the options.
  3. Select the code block option.
  4. Enter your code in the new block.

Success Criteria

  • Interface result: The quick menu inserts a new code block.
  • Next action available: You can start entering code immediately without switching to another entry point.

Tips While Using

  • Common mistake: If you stop after typing /, too many options may appear and slow down selection.
  • Environment note: Use the command in an editable text area.

3. Adjust code block settings

Entry path: Code block toolbar > Language / Fixed Height / Settings

  1. Insert a code block first and select it.
  2. Click the language name at the top left of the code block to switch languages.
  3. Switch between Fixed Height and Fit Content as needed.
  4. Open Settings and turn Line Wrap on or off.
  5. In Settings, turn Dark Theme on or off.

Success Criteria

  • Interface result: The selected language appears on the block, and the display updates based on your settings.
  • Next action available: You can keep editing the code and refine the display for reading.

Tips While Using

  • Common mistake: If the code block is not selected, the toolbar options may be less obvious.
  • Environment note: These settings are available after a code block has been inserted.