Skip to content

[FEATURE] Support Markdown in panel description - #380

Merged
AntoineThebaud merged 7 commits into
mainfrom
antoinethebaud/markdown-panel-desc
Oct 30, 2026
Merged

AntoineThebaud merged 7 commits into
mainfrom
antoinethebaud/markdown-panel-desc

Conversation

@AntoineThebaud

@AntoineThebaud AntoineThebaud commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Closes perses/perses#1640

Panel descriptions were limited to short, single-line text: the editor used a single-line input, and the header tooltip
displayed plain text in a narrow (300px) bubble. This made it impossible to provide richer context such as bullet points,
multiple paragraphs, or links to runbooks / metric documentation.

This PR makes panel descriptions multiline and renders them as Markdown (GitHub Flavored).

Changes

  • Panel editor: the Description field is now a multiline text field (grows up to 10 rows, then scrolls) with a
    "Supports Markdown" helper text.
  • Panel header tooltip: a new internal PanelDescriptionTooltip component replaces InfoTooltip for the panel
    description:
    • Markdown is converted to HTML with marked (gfm: true, breaks: true) and sanitized with DOMPurify.
    • Uses a dedicated DOMPurify instance, so its hook doesn't affect other consumers of the default singleton.
    • Links always open in a new tab with rel="noopener noreferrer".
    • The tooltip is wider (500px) and its content scrolls when longer than half the viewport height. It stays
      interactive, so links can be clicked and long content scrolled.
    • Markdown is only parsed when the tooltip is opened, not for every panel on the dashboard.
  • Dependencies: adds marked and dompurify to @perses-dev/dashboards (already used by the Perses app and the
    Markdown panel plugin).

Backward compatibility

  • No spec/schema change: display.description is still a plain string.
  • Existing plain-text descriptions render as before, and single line breaks are preserved (breaks: true), matching
    the previous white-space: pre-line behavior. Markdown syntax in existing descriptions is now interpreted (e.g. a
    line starting with # becomes a heading).
  • Raw HTML is not supported, unlike in the Markdown panel: it is displayed as text, so placeholders like
    <host>:<port> are shown as-is.
  • Variable interpolation ($var) is still applied before rendering.
  • The public InfoTooltip component from @perses-dev/components is unchanged.

Tests

  • New unit tests for panelDescriptionToHTML (plain text, line breaks, Markdown, links, XSS sanitization).
  • New Panel test checking that a Markdown description (heading, bold, list, link, variable) is rendered in the tooltip.
  • Updated the existing description test to use the real tooltip.

Screenshots

  • Editor:
2026-10-20_11h06_09
  • Tooltip on dashboard:
2026-10-20_11h06_21 2026-10-20_11h29_11

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.
  • E2E tests are stable and unlikely to be flaky.
    See e2e docs for more details. Common issues include:
    • Is the data inconsistent? You need to mock API requests.
    • Does the time change? You need to use consistent time values or mock time utilities.
    • Does it have loading states? You need to wait for loading to complete.

Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit ce51bda.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two moderate issues remain unresolved, including an SSR initialization failure and an unused import.

1 open issue
What changed in this PR

Adds GitHub-Flavored Markdown support for panel descriptions in the editor and dashboard tooltips.

Changes:

  • Makes descriptions multiline with Markdown guidance.
  • Adds sanitized, interactive Markdown tooltips.
  • Adds dependencies and rendering/security tests.

Review findings:

  • PanelActions.tsx: unused InfoTooltip import remains (moderate, 1 vote).
  • PanelDescriptionTooltip.tsx: DOMPurify initialization is not SSR-safe (moderate, 3 votes).
File Summary
package-lock.json Locks new Markdown and sanitization dependencies.
dashboards/​src/​components/​PanelDrawer/​PanelEditorForm.tsx Enables multiline descriptions.
dashboards/​src/​components/​Panel/​PanelDescriptionTooltip.tsx Implements Markdown conversion, sanitization, and tooltip behavior; has an SSR initialization issue.
dashboards/​src/​components/​Panel/​PanelDescriptionTooltip.test.tsx Tests Markdown rendering and XSS sanitization.
dashboards/​src/​components/​Panel/​PanelActions.tsx Integrates the new tooltip; retains an unused import.
dashboards/​src/​components/​Panel/​Panel.test.tsx Tests Markdown descriptions in panels.
dashboards/​package.json Adds marked and dompurify.

Review effort: Lite

@AntoineThebaud
AntoineThebaud marked this pull request as ready for review October 20, 2026 10:19
@AntoineThebaud
AntoineThebaud requested a review from a team as a code owner October 20, 2026 10:19
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

All reviewed changes have adequate test coverage and no unresolved blocking issues.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@Nexucis Nexucis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice feature, thanks! I checked it out locally on 13f1e50: the Panel tests pass (26/26), the dashboards type-check is clean, and there are no new oxlint warnings (418 → 418).

I left one should-fix (sanitizer config) and a few non-blocking suggestions inline.

Side note: the earlier automated comment about an unused InfoTooltip import in PanelActions.tsx is a false positive. It's still used by the other header actions.

@AntoineThebaud

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

…wn-panel-desc

Signed-off-by: GitHub <noreply@github.com>

# Conflicts:
#	dashboards/src/components/Panel/Panel.test.tsx

Co-authored-by: AntoineThebaud <7058693+AntoineThebaud@users.noreply.github.com>

Copilot AI commented Oct 30, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Merged main and resolved the Panel.test.tsx import conflict, preserving both branches' tests. Merge commit: fa4d58f.

@AntoineThebaud
AntoineThebaud merged commit 5773f5c into main Oct 30, 2026
15 checks passed
@AntoineThebaud
AntoineThebaud deleted the antoinethebaud/markdown-panel-desc branch October 30, 2026 15:31
jgbernalp pushed a commit that referenced this pull request Nov 24, 2026
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
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.

Multiline description for panels

5 participants