File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ <h2>sTeX mode</h2>
103103 var editor = CodeMirror . fromTextArea ( document . getElementById ( "code" ) , { } ) ;
104104 </ script >
105105
106+ < p > sTeX mode supports this option:</ p >
107+ < d1 >
108+ < dt > < code > inMathMode: boolean</ code > </ dt >
109+ < dd > Whether to start parsing in math mode (default: < code > false</ code > ).</ dd >
110+ </ d1 >
111+
106112 < p > < strong > MIME types defined:</ strong > < code > text/x-stex</ code > .</ p >
107113
108114 < p > < strong > Parsing/Highlighting Tests:</ strong > < a href ="../../test/index.html#stex_* "> normal</ a > , < a href ="../../test/index.html#verbose,stex_* "> verbose</ a > .</ p >
Original file line number Diff line number Diff line change 1616} ) ( function ( CodeMirror ) {
1717 "use strict" ;
1818
19- CodeMirror . defineMode ( "stex" , function ( ) {
19+ CodeMirror . defineMode ( "stex" , function ( _config , parserConfig ) {
2020 "use strict" ;
2121
2222 function pushCommand ( state , command ) {
173173 if ( source . eatSpace ( ) ) {
174174 return null ;
175175 }
176- if ( source . match ( endModeSeq ) ) {
176+ if ( endModeSeq && source . match ( endModeSeq ) ) {
177177 setState ( state , normal ) ;
178178 return "keyword" ;
179179 }
235235
236236 return {
237237 startState : function ( ) {
238+ var f = parserConfig . inMathMode ? function ( source , state ) { return inMathMode ( source , state ) ; } : normal ;
238239 return {
239240 cmdState : [ ] ,
240- f : normal
241+ f : f
241242 } ;
242243 } ,
243244 copyState : function ( s ) {
You can’t perform that action at this time.
0 commit comments