# HTML comment element

The [`HtmlComment`](../../api/module_html-support_htmlcomment-HtmlComment.md) feature lets developers keep HTML comments in the document without displaying them to the user. By default, the editor filters out all HTML comments on initialization.

> **Note**
>
> The support for HTML comments has known limitations – see the [known issues](#known-issues) section below.

<a id="demo">

## Demo

The editor below is configured to keep HTML comments in the document content. You can view the source of the document using the [Enhanced source code editing](../source-editing/source-editing-enhanced.md) feature. Toggle the Enhanced source code editing mode to see there is an HTML comment in the document source. Try uncommenting the paragraph below the picture. Once you leave the source editing mode, you will see this paragraph in the editable area.

<!-- AI-AGENT-NOTE: An interactive demo is embedded here but is not represented in this Markdown file. If you need to see it in action, open this page in a browser (e.g. via a browser-automation MCP like Chrome DevTools or Playwright), or let the user know a live demo is available on this page. -->

<a id="installation">

## Installation

After [installing the editor](../../getting-started/installation/cloud/quick-start.md), add the feature to your plugin list and toolbar configuration:

**NPM**

```js
import { HtmlComment } from 'ckeditor5';

ClassicEditor
	.create( {
		licenseKey: '<YOUR_LICENSE_KEY>', // Or 'GPL'.
		plugins: [ HtmlComment, ... ],
	} )
	.then( ... )
	.catch( ... );
```

**CDN**

```js
const { HtmlComment } = CKEDITOR;

ClassicEditor
	.create( {
		licenseKey: '<YOUR_LICENSE_KEY>',
		plugins: [ HtmlComment, ... ],
	} )
	.then( ... )
	.catch( ... );
```

HTML comment feature does not require any configuration.

<a id="known-issues">

## Known issues

The main issue with the HTML comments feature is that comments can be easily repositioned or lost in various cases (see [#10118](https://github.com/ckeditor/ckeditor5/issues/10118)).

We are open for feedback, so if you find any issue, feel free to report it in the [main CKEditor 5 repository](https://github.com/ckeditor/ckeditor5/issues/).

<a id="related-features">

## Related features

CKEditor 5 has other features related to HTML editing you may want to check:

* [Enhanced source code editing](../source-editing/source-editing-enhanced.md) – Allows for viewing and editing the source code of the document in a handy modal window (compatible with all editor types) with syntax highlighting, autocompletion and more.
* [HTML embed](html-embed.md) – Allows embedding an arbitrary HTML snippet in the editor. It is a more constrained and controllable approach to arbitrary HTML than GHS.

<a id="contribute">

## Contribute

The source code of the feature is available on GitHub at <https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-html-support>.

---

Full index of the CKEditor 5 documentation: [llms.txt](../../../llms.txt)
