If you wish to add text to a post or page that is displayed exactly as you type it, the Preformatted Block is for you. You can create one by clicking the Block Insertericon.
You can also type “/preformatted” and hit the enter key in an empty paragraph block to quickly create one.

Detailed instructions on adding a block can be found here.
The Preformatted Block shares a lot of similarities with the Paragraph Block and the Code Block. Think of it as a hybrid of the two.
LikeParagraph Block, the Preformatted Block is intended primarily to display text. Unlike the Paragraph Block, though, the Preformatted Block keeps any spacing or line breaks exactly as they are entered.
Similar to the Code Block, the Preformatted Block is displayed in a monospace font, making it easy to keep text perfectly aligned. However, the Preformatted Block also includes styling and the ability to add hyperlinks (described below) that a Code Block doesn’t have.
Block Toolbar
Every block comes with unique toolbar icons and block specific user controls that allow you to manipulate the block right in the editor.
ThePreformatted Block shows standard seven buttons:
- Change block type or style
- Moving handles
- 粗体
- 斜体
- Hyperlink
- More rich text controls
- 更多选项

Change block type or style

You can transform the Preformatted BlockintoParagraph Block,Code Block,orGroup. The Group would give you the ability to change the background color around the Preformatted Block.

Moving handles

The up and down arrow icons can be used to shift a block up and down in your document.
Detailed instructions on moving a block within the editor can be found here.
粗体

You can select the text of the block and use the 粗体 option or Ctrl+B/Cmd+B on your keyboard to bold it, which is usually heavier than the surrounding text.
斜体

You can select the text of the block and use the 斜体 option or Ctrl+I/Cmd+Ion your keyboard to italicize it, which usually appears slanted to the right.
Hyperlink

You can select the text of the block and use the Hyperlink option or Ctrl+K/Cmd+K on your keyboard to add a link to it.
More rich text controls

Inline Code
Inline Code can be used to indicate that the text is a short fragment of computer code.
Inline image
Inline image can be used to place an image in the text.
Strikethrough
Strikethrough can be used to place a horizontal line through the middle of the selected text.
Example: Preformatted Block
Subscript
Subscript can be used to set character slightly below the normal line of type.
Example: Preformatted Block
Superscript
Superscript can be used to set character slightly above the normal line of type.
Example: Preformatted Block
Text Color
Text Color can be used to set the color of the text.
Example: Preformatted, Paragraph, Image
更多选项

Hide Block Settings
The Hide Block Settings option hides (or shows) the Block Setting panel in the editor’s sidebar.
Copy
Copy can be used to copy a selected block and then you can paste it wherever you want in the editor.
Duplicate
Duplicate can be used to duplicate selected block.
Insert Before
Insert a new block before the selected block(s).
Insert After
Insert a new block after the selected block(s).
Move To
If you select Move To, you will get a blue line inside your content, you can then use the arrows to move that line up and down to where you want the selected content to be moved into, hitting return on your keyboard at that point moves the block to that position.
Instruction on using Move To option to move a block can be found here.
Edit as HTML
The Edit as HTML option allows you to modify the HTML code of the embed block.

Add to Reusable blocks
Using the Add to Reusable blocks option lets you add the selected block to a list of reusable blocks, so you can use them on other posts or pages as well.
Group
Select the Group option if you want to create a group of blocks and treat them as a unit. You can for instance add a common background color or other blocks to the group.
Remove Block
With the Remove Blockoption, you can delete the selected block from your content
区块设置
Every block has specific options in the editor sidebar in addition to the options found in the block toolbar. If you do not see the sidebar, click the ‘cog’ icon next to the Publish button.

Advanced
TheAdvanced tab lets you add HTML anchor and CSS class(es) to your block.

HTML anchor allows you to make a unique web address for a particular Preformatted Block. Then, you’ll be able to link directly to a Preformatted Block of your page.
TheAdditional CSS class(es) lets you add CSS class(es) to your block, allowing you to write custom CSS and style the block as you see fit.
Changelog
- Updated 2020-10-25
- Screenshots and video as per LitePress 5.5
- Added feature changes in Block Toolbar
- Added feature changes in Block Settings
- Added “Go back to the list of Blocks” to the top of the page
- Created 2019-03-07