Skip to content

Add accTitle/accDescr accessibility directives to all diagram types#7

Open
theletterf wants to merge 1 commit intonullean:mainfrom
theletterf:feat/accessibility-directives
Open

Add accTitle/accDescr accessibility directives to all diagram types#7
theletterf wants to merge 1 commit intonullean:mainfrom
theletterf:feat/accessibility-directives

Conversation

@theletterf
Copy link
Copy Markdown

Summary

  • Add AccessibilityInfo model and AccessibilityParser pre-processor
  • Parse accTitle: ..., accDescr: ... (single-line), and accDescr { ... } (multi-line)
  • SVG output includes role="img", aria-roledescription, aria-label, <title>, <desc>
  • Works across all 13 diagram types
  • Backwards compatible: no attributes when directives are absent

Changes

  • AccessibilityInfo.cs — new model record
  • AccessibilityParser.cs — shared pre-processor with Extract() method
  • MermaidRenderer.cs — calls parser, passes info to renderers
  • StyleBlock.csAppendSvgOpenTag accepts accessibility info, emits ARIA attributes
  • All 11 SVG renderer files — updated signatures to pass through accessibility info
  • AccessibilityTests.cs — 24 new tests

Test plan

  • All 438 tests pass (414 existing + 24 new)
  • All 13 diagram types tested with correct aria-roledescription
  • Single-line and multi-line accDescr
  • HTML character escaping in titles
  • No regression when directives are absent

🤖 Generated with Claude Code

- Add AccessibilityInfo model and AccessibilityParser pre-processor
- Parse accTitle, accDescr (single-line), accDescr { multi-line }
- SVG output includes role=img, aria-roledescription, aria-label, <title>, <desc>
- Works across all 13 diagram types
- Backwards compatible: no attributes when directives are absent
- 24 new tests covering all diagram types and edge cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.

1 participant