Repository navigation
Conversation
…led by default Raw HTML in Markdown panels is now escaped and displayed as plain text unless the new enableHtml option is set, so placeholders such as <host>:<port> are no longer stripped by the sanitizer. DOMPurify is kept as a second layer in both modes. Grafana text panels in html mode are migrated with enableHtml: true. The option is available in the panel editor, the CUE schema, the Go SDK (EnableHTML) and the docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Align the option name with perses/perses#4684. The Go SDK option is renamed from EnableHTML to RenderHTML. HTML rendering stays disabled by default, and Grafana text panels in html mode are still migrated with renderHtml: true. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Gladorme
marked this pull request as ready for review
October 30, 2026 16:24
Gladorme
requested review from
a team,
AntoineThebaud and
Nexucis
as code owners
October 30, 2026 16:24
jgbernalp
reviewed
Nov 2, 2026
Contributor
|
Is this a breaking change? it seems the renderHTML in the schema is optional, so this should be backwards compatible |
Member
Author
I would like to have the same behavior of perses/shared#380. I find Markdown content different between two components is strange 👀 |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the opt-in HTML rendering change.
No open issues 🎉
What changed in this PR
This PR makes raw HTML rendering opt-in for Markdown panels, preserving literal placeholders such as <host>:<port> by default while retaining sanitization in both modes.
Changes:
- Adds
renderHtmlacross the panel runtime, editor, TypeScript model, CUE schema, Go SDK, and documentation. - Preserves HTML rendering when migrating Grafana text panels in HTML mode.
- Adds rendering, editor, schema-validation, and migration coverage.
| File | Description |
|---|---|
markdown/src/MarkdownPanelOptionsEditor.tsx |
Adds the Render HTML toggle and preserves options during edits. |
markdown/src/MarkdownPanelOptionsEditor.test.tsx |
Tests the toggle default and option preservation. |
markdown/src/MarkdownPanel.tsx |
Escapes raw HTML by default and supports opt-in rendering. |
markdown/src/MarkdownPanel.test.ts |
Tests escaping, Markdown rendering, and HTML sanitization. |
markdown/src/markdown-panel-model.ts |
Defines the optional renderHtml field. |
markdown/sdk/go/options.go |
Adds the RenderHTML builder option. |
markdown/sdk/go/markdown.go |
Adds HTML-rendering configuration to the serialized spec. |
markdown/schemas/tests/valid/markdown-with-html.json |
Adds a valid HTML-enabled configuration fixture. |
markdown/schemas/tests/invalid/markdown-invalid-render-html.json |
Adds an invalid non-boolean configuration fixture. |
markdown/schemas/migrate/tests/text/expected.json |
Expects HTML rendering for the HTML-mode migration fixture. |
markdown/schemas/migrate/tests/text-markdown/input.json |
Adds a Grafana Markdown-mode migration input. |
markdown/schemas/migrate/tests/text-markdown/expected.json |
Expects Markdown-mode migration without HTML opt-in. |
markdown/schemas/migrate/migrate.cue |
Enables HTML rendering when migrating HTML-mode text panels. |
markdown/schemas/markdown.cue |
Accepts the optional boolean renderHtml field. |
docs/markdown/model.md |
Documents the option, default, and sanitization behavior. |
docs/markdown/go-sdk.md |
Documents the RenderHTML builder option. |
Review effort: Balanced
… the renderer Overriding the html renderer did not escape everything: content following a raw <code>, <kbd> or <pre> tag was kept as HTML, so e.g. an <img> nested in <code> was still rendered and loaded when renderHtml is disabled. Raw HTML is now not tokenized at all, so it is escaped as plain text. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
6 tasks done
AntoineThebaud
approved these changes
Nov 26, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Close issue: perses/perses#4684
Raw HTML in Markdown panels is now escaped and displayed as plain text unless the new enableHtml option is set, so placeholders such as : are no longer stripped by the sanitizer. DOMPurify is kept as a second layer in both modes. Grafana text panels in html mode are migrated with enableHtml: true. The option is available in the panel editor, the CUE schema, the Go SDK (RenderHTML) and the docs. Aligning with panel description (perses/shared#380).
Breaking change
Raw HTML render is disabled by default, if necessary you can re-enable it with
renderHtml: trueScreenshots
Render disabled:

Render enabled:

Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes