Skip to content

Fix Mermaid style check to exempt diagram types without style directive support#1577

Merged
pethers merged 2 commits intomainfrom
copilot/fix-article-and-update-tests
Apr 6, 2026
Merged

Fix Mermaid style check to exempt diagram types without style directive support#1577
pethers merged 2 commits intomainfrom
copilot/fix-article-and-update-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

hasMermaidStyling() required explicit style directives on all Mermaid blocks, but several Mermaid diagram types (quadrantChart, pie, gantt, gitGraph, timeline, mindmap, sankey) don't support style directives at all. This forced content authors to avoid these chart types in strict-v2 risk files.

  • Test fix: Added INHERENTLY_STYLED_MERMAID pattern to recognize diagram types that are styled by the renderer, not by explicit directives
  • Logic change: hasMermaidStyling() now uses every — each block must be either explicitly styled OR an inherently-styled type
  • Content revert: Restored evening-analysis/risk-assessment.md back to quadrantChart (better fit for risk matrices than graph TD)
const INHERENTLY_STYLED_MERMAID = /```mermaid\s*\n\s*(quadrantChart|pie|gantt|gitGraph|timeline|mindmap|sankey)/;

function hasMermaidStyling(text: string): boolean {
  const blocks = text.match(MERMAID_BLOCK_PATTERN);
  if (!blocks) return false;
  return blocks.every(block =>
    MERMAID_STYLE_PATTERN.test(block) || INHERENTLY_STYLED_MERMAID.test(block)
  );
}

@pethers pethers marked this pull request as ready for review April 6, 2026 20:12
Copilot AI review requested due to automatic review settings April 6, 2026 20:12
@github-actions github-actions bot added testing Test coverage size-xs Extra small change (< 10 lines) labels Apr 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: testing,size-xs

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the analysis quality validation so Mermaid diagram types that cannot use style directives (e.g. quadrantChart, pie) are no longer incorrectly flagged as “unstyled” in strict-v2 risk assessment files.

Changes:

  • Added an INHERENTLY_STYLED_MERMAID regex to recognize Mermaid diagram types styled by the renderer rather than style directives.
  • Updated hasMermaidStyling() to require that every Mermaid block is either explicitly styled or inherently styled.

@pethers pethers merged commit c79a461 into main Apr 6, 2026
19 checks passed
@pethers pethers deleted the copilot/fix-article-and-update-tests branch April 7, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-xs Extra small change (< 10 lines) testing Test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants