Repository navigation
[FEATURE] Support Markdown in panel description - #380
Conversation
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
There was a problem hiding this comment.
🟡 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: unusedInfoTooltipimport 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
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
1feb685 to
13f1e50
Compare
Nexucis
left a comment
There was a problem hiding this comment.
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.
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
a39ae11 to
bf7139a
Compare
|
@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>
Merged |
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr> Signed-off-by: Gabriel Bernal <gbernal@redhat.com>

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
"Supports Markdown" helper text.
PanelDescriptionTooltipcomponent replacesInfoTooltipfor the paneldescription:
marked(gfm: true,breaks: true) and sanitized withDOMPurify.rel="noopener noreferrer".interactive, so links can be clicked and long content scrolled.
markedanddompurifyto@perses-dev/dashboards(already used by the Perses app and theMarkdown panel plugin).
Backward compatibility
display.descriptionis still a plain string.breaks: true), matchingthe previous
white-space: pre-linebehavior. Markdown syntax in existing descriptions is now interpreted (e.g. aline starting with
#becomes a heading).<host>:<port>are shown as-is.$var) is still applied before rendering.InfoTooltipcomponent from@perses-dev/componentsis unchanged.Tests
panelDescriptionToHTML(plain text, line breaks, Markdown, links, XSS sanitization).Paneltest checking that a Markdown description (heading, bold, list, link, variable) is rendered in the tooltip.Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
See e2e docs for more details. Common issues include: