diff --git a/extension.json b/extension.json index 664827dea..b16b8f9e9 100644 --- a/extension.json +++ b/extension.json @@ -27,7 +27,7 @@ "MediaWiki\\Extension\\Math\\WikiTexVC\\MMLmappings\\Util\\MMLComparator": "tests/phpunit/unit/WikiTexVC/MMLComparator.php" }, "DefaultUserOptions": { - "math": "mathml", + "math": "native", "math-popups": "1" }, "ExtensionMessagesFiles": { @@ -161,7 +161,8 @@ "description": "To access this at run-time, use MathConfig::getValidRenderingModes(). Do not use the non-normalized configuration directly.", "value": [ "source", - "mathml" + "native", + "mathjax" ] }, "MathEnableWikibaseDataType": { diff --git a/src/MathConfig.php b/src/MathConfig.php index 7bfaa2b76..78a1f0c17 100644 --- a/src/MathConfig.php +++ b/src/MathConfig.php @@ -162,7 +162,7 @@ class MathConfig { * @param string $default rendering mode to use by default on unrecognized input * @return string one of the self::MODE_* constants. */ - public static function normalizeRenderingMode( $mode, string $default = self::MODE_MATHML ): string { + public static function normalizeRenderingMode( $mode, string $default = self::MODE_NATIVE_MML ): string { if ( is_int( $mode ) ) { $userOptionToMode = array_flip( self::MODES_TO_USER_OPTIONS ); return $userOptionToMode[$mode] ?? $default; diff --git a/tests/phpunit/unit/MathConfigTest.php b/tests/phpunit/unit/MathConfigTest.php index a7f1cec37..7ccca4916 100644 --- a/tests/phpunit/unit/MathConfigTest.php +++ b/tests/phpunit/unit/MathConfigTest.php @@ -53,6 +53,8 @@ class MathConfigTest extends TestCase { yield 'mathml user option' => [ 5, MathConfig::MODE_MATHML ]; yield 'latexml user option' => [ 7, MathConfig::MODE_LATEXML ]; yield 'native user option' => [ 8, MathConfig::MODE_NATIVE_MML ]; + yield 'mathjax option' => [ 9, MathConfig::MODE_NATIVE_JAX ]; + yield 'source string' => [ 'source', MathConfig::MODE_SOURCE ]; yield 'mathml string' => [ 'mathml', MathConfig::MODE_MATHML ]; yield 'latexml string' => [ 'latexml', MathConfig::MODE_LATEXML ]; @@ -72,14 +74,13 @@ class MathConfigTest extends TestCase { public function testGetValidRenderingModes() { $mathConfig = $this->newMathConfig( [ 'MathValidModes' => [ - MathConfig::MODE_MATHML, - 5, + MathConfig::MODE_NATIVE_MML, MathConfig::MODE_SOURCE, 'this will be converted to mathml' ], ] ); $actualModes = $mathConfig->getValidRenderingModes(); $this->assertCount( 2, $actualModes ); - $this->assertContains( MathConfig::MODE_MATHML, $actualModes ); + $this->assertContains( MathConfig::MODE_NATIVE_MML, $actualModes ); $this->assertContains( MathConfig::MODE_SOURCE, $actualModes ); }