File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ nmp install mj-context-menu
2424
2525Create a symbolic link for the context menu. MathJax expects it to be _ in parallel_ to its code.
2626
27- ``` sheel
27+ ``` shell
2828ln -s node_modules/mj-context-menu
2929```
3030
Original file line number Diff line number Diff line change @@ -158,6 +158,21 @@ const Lab = window.Lab = {
158158 return math ;
159159 } ,
160160
161+ readInput ( ) {
162+ let input = this . input . value ;
163+ if ( this . format !== 'MathML' ) {
164+ return input ;
165+ }
166+ input = input . trim ( ) ;
167+ if ( ! input . match ( / ^ < m a t h / ) ) {
168+ input = '<math xmlns="http://www.w3.org/1998/Math/MathML">' + input ;
169+ }
170+ if ( ! input . match ( / \/ m a t h > $ / ) ) {
171+ input += '</math>' ;
172+ }
173+ return input ;
174+ } ,
175+
161176 /**
162177 * Perform the typesetting of the math in the proper format
163178 */
@@ -175,7 +190,7 @@ const Lab = window.Lab = {
175190 // set its metrics, and link it to the text element created above, then
176191 // add it to the document's math list.
177192 //
178- this . mathItem = this . MathItem ( this . input . value , this . output ) ;
193+ this . mathItem = this . MathItem ( this . readInput ( ) , this . output ) ;
179194 this . doc . clear ( ) ;
180195 this . doc . math . push ( this . mathItem ) ;
181196
You can’t perform that action at this time.
0 commit comments