-
Notifications
You must be signed in to change notification settings - Fork 220
DOC-3147: New allow_html_in_comments option to allow HTML-like content inside comment data
#3791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kemister85
merged 3 commits into
feature/8.0.0/DOC-3147
from
feature/8.0.0/DOC-3147_TINY-12220
Jul 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
modules/ROOT/partials/configuration/allow_html_in_comments.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| [[allow_html_in_comments]] | ||
| == `allow_html_in_comments` | ||
|
|
||
| The `allow_html_in_comments` option allows HTML-like content to be retained in comments within the editor content. By default, {productname} removes comments containing HTML-like content as a security measure (using DOMPurify's `SAFE_FOR_XML` option). | ||
|
kemister85 marked this conversation as resolved.
Outdated
|
||
|
|
||
| *Type:* `+Boolean+` | ||
|
|
||
| *Default value:* `+false+` | ||
|
|
||
| [WARNING] | ||
| Setting this option to `true` may expose your application to XSS vulnerabilities. The DOMPurify maintainers have identified potential security risks when HTML-like content is allowed in comments. Only enable this option if you trust your content sources and understand the security implications. | ||
|
|
||
| === Example: using `allow_html_in_comments` | ||
|
|
||
| The following example demonstrates how comments containing HTML are handled by default (removed) and how to configure {productname} to retain them: | ||
|
|
||
| [source,js] | ||
| ---- | ||
| tinymce.init({ | ||
| selector: 'textarea', | ||
| allow_html_in_comments: true, // Enable HTML in comments | ||
| }); | ||
| ---- | ||
|
|
||
| ifeval::["{docname}" != "security"] | ||
| === Comment behavior examples | ||
|
|
||
| With `allow_html_in_comments: false` (default), the editor's content after initialization will be: | ||
| [source,html] | ||
| ---- | ||
| <section> | ||
| <h1>Some content</h1> | ||
| <h1>Some additional content</h1> | ||
| </section> | ||
| ---- | ||
|
|
||
| With `allow_html_in_comments: true`, the editor's content after initialization will be: | ||
| [source,html] | ||
| ---- | ||
| <section> | ||
| <h1>Some content</h1> | ||
| <!-- | ||
| <div>This is my comment content</div> | ||
| --> | ||
| <h1>Some additional content</h1> | ||
| </section> | ||
| ---- | ||
| endif::[] | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.