Reviewed-on: https://git.qiuwen.wiki/qiuwen/SimpleMathJax/pulls/1
这个提交包含在:
当前提交
ee708368eb
|
@ -1,3 +1,3 @@
|
|||
[submodule "resources/MathJax"]
|
||||
path = resources/MathJax
|
||||
url = https://github.com/mathjax/MathJax.git
|
||||
url = https://git.qiuwen.wiki/mirror/MathJax
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
class SimpleMathJaxHooks {
|
||||
|
||||
public static function onParserFirstCallInit( Parser $parser ) {
|
||||
|
@ -13,6 +13,8 @@ class SimpleMathJaxHooks {
|
|||
$wgOut->addJsConfigVars( 'wgSmjScale', $wgSmjScale );
|
||||
$wgOut->addJsConfigVars( 'wgSmjEnableMenu', $wgSmjEnableMenu );
|
||||
$wgOut->addJsConfigVars( 'wgSmjDisplayAlign', $wgSmjDisplayAlign );
|
||||
$wgOut->addModules( [ 'ext.SimpleMathJax' ] );
|
||||
$wgOut->addModules( [ 'ext.SimpleMathJax.mobile' ] ); // For MobileFrontend
|
||||
|
||||
$parser->setHook( 'math', __CLASS__ . '::renderMath' );
|
||||
if( $wgSmjUseChem ) $parser->setHook( 'chem', __CLASS__ . '::renderChem' ); }
|
||||
|
@ -31,8 +33,6 @@ class SimpleMathJaxHooks {
|
|||
}
|
||||
|
||||
private static function renderTex($tex, $parser) {
|
||||
$parser->getOutput()->addModules( 'ext.SimpleMathJax' );
|
||||
$parser->getOutput()->addModules( 'ext.SimpleMathJax.mobile' ); // For MobileFrontend
|
||||
$attributes = [ "style" => "opacity:.5" ];
|
||||
Hooks::run( "SimpleMathJaxAttributes", [ &$attributes, $tex ] );
|
||||
$element = Html::Element( "span", $attributes, "[math]{$tex}[/math]" );
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
{
|
||||
"name": "SimpleMathJax",
|
||||
"version": "0.8.2",
|
||||
"author": "jmnote",
|
||||
"url": "https://www.mediawiki.org/wiki/Extension:SimpleMathJax",
|
||||
"version": "0.8.3",
|
||||
"author": [
|
||||
"jmnote",
|
||||
"Qiuwen Baike Contributors"
|
||||
],
|
||||
"url": "https://git.qiuwen.wiki/qiuwen/SimpleMathJax",
|
||||
"description": "render TeX between <code><nowiki><math></nowiki></code> and <code><nowiki></math></nowiki></code>",
|
||||
"license-name": "GPL-2.0+",
|
||||
"type": "parserhook",
|
||||
|
@ -24,7 +27,8 @@
|
|||
},
|
||||
"ResourceModules": {
|
||||
"ext.SimpleMathJax": {
|
||||
"scripts": ["resources/ext.SimpleMathJax.js"]
|
||||
"scripts": ["resources/ext.SimpleMathJax.js"],
|
||||
"targets": ["desktop", "mobile"]
|
||||
}
|
||||
},
|
||||
"ResourceFileModulePaths": {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
mw.hook( 'wikipage.categories' ).add( function ( $content ) {
|
||||
mw.hook( 'wikipage.content' ).add( function ( $content ) {
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: mw.config.get('wgSmjExtraInlineMath').concat([['[math]','[/math]']]),
|
||||
|
@ -125,9 +125,7 @@ window.MathJax = {
|
|||
};
|
||||
(function () {
|
||||
var script = document.createElement('script');
|
||||
script.src = mw.config.get('wgSmjUseCdn')
|
||||
? 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js'
|
||||
: mw.config.get('wgExtensionAssetsPath') + '/SimpleMathJax/resources/MathJax/es5/tex-chtml.js';
|
||||
script.src = mw.config.get('wgExtensionAssetsPath') + '/SimpleMathJax/resources/MathJax/es5/tex-chtml.js';
|
||||
script.async = true;
|
||||
document.head.appendChild(script);
|
||||
})();
|
||||
|
|
正在加载...
在新工单中引用