From 3a72826ff3c36208ef8187c843c438fcb15ab84c Mon Sep 17 00:00:00 2001 From: SomeRandomDeveloper Date: Fri, 24 Oct 2025 01:04:37 +0200 Subject: [PATCH] Use namespaced Html class if available This fixes compatibility with MW 1.44. Issue: #127 --- src/MermaidParserFunction.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/MermaidParserFunction.php b/src/MermaidParserFunction.php index 291e8bd..0d179ef 100644 --- a/src/MermaidParserFunction.php +++ b/src/MermaidParserFunction.php @@ -3,7 +3,6 @@ namespace Mermaid; use Parser; -use Html; use MediaWiki\MediaWikiServices; /** @@ -81,7 +80,13 @@ public function parse( array $params ) { $content = implode( "|", $mwParams ); $graphConfig = array_merge( $graphConfig, $mermaidConfig ); - return Html::rawElement( + if ( class_exists( 'MediaWiki\\Html\\Html' ) ) { + // MW 1.40+ + $htmlClass = \MediaWiki\Html\Html::class; + } else { + $htmlClass = \Html::class; + } + return $htmlClass::rawElement( 'div', [ 'class' => $class, @@ -92,7 +97,7 @@ public function parse( array $params ) { ] ) ], - Html::rawElement( + $htmlClass::rawElement( 'div', [ 'class' => 'mermaid-dots',