File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
src/frontend/core/renderers/MarkdownRenderer Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -45,15 +45,20 @@ class MarkdownRenderer extends Renderer {
45
45
} ;
46
46
47
47
const image = ( { src, ...rest } ) => {
48
- let newSrc ;
49
- const codecogs = 'https://latex.codecogs.com/svg.latex?' ;
50
- if ( src . startsWith ( codecogs ) ) {
51
- const latex = src . substring ( codecogs . length ) ;
52
- newSrc = `${ codecogs } \\color{White}${ latex } ` ;
53
- } else {
54
- newSrc = src ;
48
+ let newSrc = src ;
49
+ let style = { maxWidth : '100%' } ;
50
+ const CODECOGS = 'https://latex.codecogs.com/svg.latex?' ;
51
+ const WIKIMEDIA_IMAGE = 'https://upload.wikimedia.org/wikipedia/' ;
52
+ const WIKIMEDIA_MATH = 'https://wikimedia.org/api/rest_v1/media/math/render/svg/' ;
53
+ if ( src . startsWith ( CODECOGS ) ) {
54
+ const latex = src . substring ( CODECOGS . length ) ;
55
+ newSrc = `${ CODECOGS } \\color{White}${ latex } ` ;
56
+ } else if ( src . startsWith ( WIKIMEDIA_IMAGE ) ) {
57
+ style . backgroundColor = 'white' ;
58
+ } else if ( src . startsWith ( WIKIMEDIA_MATH ) ) {
59
+ style . filter = 'invert(100%)' ;
55
60
}
56
- return < img src = { newSrc } style = { { maxWidth : '100%' } } { ...rest } /> ;
61
+ return < img src = { newSrc } style = { style } { ...rest } /> ;
57
62
} ;
58
63
59
64
return (
You can’t perform that action at this time.
0 commit comments