Skip to content

[BREAKINGCHANGE] Markdown: add option to enable HTML rendering - #905

Open
Gladorme wants to merge 2 commits into
perses:mainfrom
Gladorme:agents/add-html-rendering-panel-option
Open

Gladorme wants to merge 2 commits into
perses:mainfrom
Gladorme:agents/add-html-rendering-panel-option

Conversation

@Gladorme

@Gladorme Gladorme commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

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: true

Screenshots

Render disabled:
image

Render enabled:
image

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

Gladorme and others added 2 commits October 30, 2026 16:52
…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
Gladorme marked this pull request as ready for review October 30, 2026 16:24
@Gladorme
Gladorme requested review from a team, AntoineThebaud and Nexucis as code owners October 30, 2026 16:24
@Gladorme
Gladorme requested review from jgbernalp and removed request for a team October 30, 2026 16:24
const markdownWithoutHTML = new Marked({
gfm: true,
renderer: {
html: ({ text }): string => escapeHTML(text),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overriding the html renderer might not be enough to scape actual HTML. For example passing:

prefix <code><img/src=//example.com/tracker></code>

would still load an image.

We might need something like:

const markdownWithoutHTML = new Marked({
  gfm: true,
  tokenizer: {
    html(): undefined {
      return undefined;
    },
    tag(): undefined {
      return undefined;
    },
  },
});

@jgbernalp

Copy link
Copy Markdown
Contributor

Is this a breaking change? it seems the renderHTML in the schema is optional, so this should be backwards compatible

@Gladorme

Gladorme commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Is this a breaking change? it seems the renderHTML in the schema is optional, so this should be backwards compatible

I would like to have the same behavior of perses/shared#380. I find Markdown content different between two components is strange 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants