Using HTML blocks to edit code in articles and content blocks

What's my plan?

All Suites | Enterprise or Enterprise Plus

Support with | Guide Enterprise

Note: The new article editor supports HTML blocks in both content blocks and articles. If you're using the legacy article editor, you can only use HTML blocks in content blocks. For more information about migrating from the legacy editor to the new article editor, see Transitioning to the new article editor.

You can use HTML blocks to quickly access and edit complex HTML code in your content blocks and articles. HTML blocks let you work with blocks of code that would otherwise not be editable within the editor, and display them in a safe manner within your help center.

This article contains the following sections:

About HTML blocks

Creating HTML blocks

Editing HTML blocks

Unlinking HTML blocks

Deleting HTML blocks

About HTML blocks

With HTML blocks, you can copy and paste unsupported code for HTML elements into the source code editor. The code is then wrapped in an HTML block and displayed within the article or content block. You can click the HTML block to open a source code editor that displays only the code for that block. You can use this focused view to manipulate the HTML for your selected content without scrolling through the source code for the entire content block or article.

When you update the content block or article, HTML elements associated with the HTML block appear in all published articles or content blocks that contain the HTML block. You can use HTML blocks for any block of unsupported HTML code, including complex HTML scripts or elements such as tables of contents, accordions, tabs, or steppers.

Creating HTML blocks

You can create an HTML block by either pasting a block of code into the source code editor, or by using the the keyboard shortcut (cmd + option + h / ctrl + alt + h) to create an empty HTML block. Once created, you can access HTML block code from within the HTML block editor or the article source code editor.
Note: For HTML blocks to display in the browser, you must enable unsafe content. See Editing the source code of help center articles.

To create an HTML block in a content block

In help center or Knowledge admin, create or edit a content block.

In the content block editor, click HTML on the toolbar.

In the source code editor, create or edit the unsupported source code you want to use.

Click Apply to save the code and return to the content block editor. The unsupported code appears as an HTML block within the editor. You can click the HTML block to display additional options, or you can click and drag the block around the editor to move the element to a new location.

To create an HTML block in an article
Note: This option is only available in the new article editor.

In the help center or Knowledge admin, create or edit an article.

Click the Article components button ( ) on the article editor toolbar, then select HTML block.

In the HTML block editor, create or edit the unsupported source code you want to use.

Click Insert to save the code and return to the article editor.
The unsupported code appears as an HTML block within the editor.

You can click the HTML block to display additional options or you can click and drag the block around the editor to move the element to a new location.

Editing HTML blocks

HTML blocks let you easily locate and work with the source code for that block. Instead of scrolling through the source code, you can access and edit the source code for the HTML block directly from the content block or article editor.

To edit an HTML block

Open the article or content block that contains the HTML block you want to edit in Edit mode.

Click the HTML block you want to edit to display the option icons, then select the edit icon ( ).
The HTML block editor opens in edit mode.

Make any necessary changes in the HTML block editor.

Click Apply.
Your updates are saved and visible in all articles and content blocks that contain the HTML block. You do not need to republish the articles for the changes in content blocks to appear.

Unlinking HTML blocks

You can unlink HTML blocks to inline the HTML block and remove any unsupported markup from the content. You can preview the code that will be removed prior to unlinking it.

To unlink an HTML block

Open the article or content block that contains the HTML block you want to edit in Edit mode.

Click the HTML block you want to delete to expose the option icons, then select the unlink icon ( ).

Review the code that will be unlinked to make sure you understand what will be removed. To continue, click Unlink.

The HTML block is unlinked and unsupported code is removed.

Click Update (for content blocks) or Save (for articles).
The HTML block is unlinked in all content blocks and articles.

Deleting HTML blocks

Deleting HTML blocks removes the block, including the text and code within that block, from the article. When you delete an HTML block, the block is immediately removed, without confirmation, and can't be undone.

To delete an HTML block

Open the article or content block that contains the HTML block you want to edit in Edit mode.

Click the HTML block you want to delete to expose the option icons, then select the delete icon ( ).
The HTML block is removed, without confirmation.

Click Update (for content blocks) or Save (for articles).
The HTML block is deleted in all articles in which the content block appears.