Preformatted Block

The WordPress Preformatted Block is a feature in the WordPress editor (both the Classic Editor and the Gutenberg Block Editor) that allows you to add text to your posts or pages with preformatted styling. This means the text will appear exactly as you enter it, maintaining all your spacing, line breaks, and text formatting.

Here’s a simple guide on how to use the Preformatted Block:

  1. Accessing the Block:
    • In the WordPress editor, click on the “+” button to add a new block.
    • Search for “Preformatted” in the block search bar, or find it in the text category.
    • Click on it to add it to your post or page.
  2. Using the Block:
    • Once the block is added, you can start typing your text directly into it.
    • Any spaces, line breaks, and text formatting you apply will be preserved.
    • This block is particularly useful for sharing code snippets or other text where the formatting is important, as it uses a monospace font by default.
  3. Customizing the Block:
    • You can change the text’s appearance (like font size and color) using the block settings on the right-hand side.
    • Advanced users can also add custom CSS classes for further styling.
  4. Preview and Publish:
    • Always preview your post or page to see how the Preformatted Block appears on your site.
    • Once satisfied, you can publish or update your post/page.

Remember, the Preformatted Block is different from a Paragraph Block or a Code Block. It maintains the white space and line breaks but doesn’t format text as code (like the Code Block does). This makes it ideal for displaying preformatted text like poetry or ASCII art, where the layout is as important as the text itself.