@@ -141,7 +141,7 @@ class _KatexParser {
141
141
// Aggregate the CSS styles that apply, in the same order as the CSS
142
142
// classes specified for this span, mimicking the behaviour on web.
143
143
//
144
- // Each case in the switch blocks below is a separate CSS class definition
144
+ // Each case in the switch block below is a separate CSS class definition
145
145
// in the same order as in katex.scss :
146
146
// https://github.com/KaTeX/KaTeX/blob/2fe1941b/src/styles/katex.scss
147
147
// A copy of class definition (where possible) is accompanied in a comment
@@ -178,10 +178,10 @@ class _KatexParser {
178
178
styles.fontFamily = 'KaTeX_Main' ;
179
179
classFound = true ;
180
180
181
- case 'textsf' :
182
- // .textsf { font-family: KaTeX_SansSerif; }
183
- styles.fontFamily = 'KaTeX_SansSerif' ;
184
- classFound = true ;
181
+ // case 'textsf':
182
+ // // .textsf { font-family: KaTeX_SansSerif; }
183
+ // This CSS rule has no effect, because the other `.textsf` rule below
184
+ // has the exact same list of declarations. Handle it there instead.
185
185
186
186
case 'texttt' :
187
187
// .texttt { font-family: KaTeX_Typewriter; }
@@ -261,13 +261,7 @@ class _KatexParser {
261
261
// .textscr { font-family: KaTeX_Script; }
262
262
styles.fontFamily = 'KaTeX_Script' ;
263
263
classFound = true ;
264
- }
265
264
266
- // We can't add the case for the next class (.mathsf, .textsf) in the
267
- // above switch block, because there is already a case for .textsf above.
268
- // So start a new block, to keep the order of the cases here same as the
269
- // CSS class definitions in katex.scss .
270
- switch (spanClass) {
271
265
case 'mathsf' :
272
266
case 'textsf' :
273
267
// .mathsf,
@@ -378,13 +372,11 @@ class _KatexParser {
378
372
throw KatexHtmlParseError ();
379
373
380
374
// TODO handle more classes from katex.scss
381
- }
382
375
383
- // Ignore these classes because they don't have a CSS definition
384
- // in katex.scss, but we encounter them in the generated HTML.
385
- switch (spanClass) {
386
376
case 'mord' :
387
377
case 'mopen' :
378
+ // Ignore these classes because they don't have a CSS definition
379
+ // in katex.scss, but we encounter them in the generated HTML.
388
380
classFound = true ;
389
381
}
390
382
0 commit comments