File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { combineDefaults , combineWithMathJax } from '#js/components/global.js' ;
22import { Package } from '#js/components/package.js' ;
33import { hasWindow } from '#js/util/context.js' ;
4+ import { mathjax } from '#js/mathjax.js'
45
56export function configFont ( font , jax , config , extension = '' ) {
6- const path = ( config . fontPath || `[fonts]/%%FONT%%-font${ extension } ` ) ;
7+ const version =
8+ ( MathJax . config . loader ?. paths ?. fonts || '' ) . substring ( 0 , 24 ) === 'https://cdn.jsdelivr.net'
9+ ? `@%%VERSION%%` : '' ;
10+ const path = ( config . fontPath || `[fonts]/%%FONT%%-font${ extension } ${ version } ` ) ;
711 const name = ( font . match ( / ^ [ a - z ] + : / ) ? ( font . match ( / [ ^ / : \\ ] * $ / ) || [ jax ] ) [ 0 ] : font ) ;
812 combineDefaults ( MathJax . config . loader , 'paths' , {
9- [ name + extension ] : ( name === font ? path . replace ( / % % F O N T % % / g, font ) : font )
13+ [ name + extension ] : (
14+ name === font
15+ ? path . replace ( / % % F O N T % % / g, font ) . replace ( / % % V E R S I O N % % / g, mathjax . version )
16+ : font
17+ )
1018 } ) ;
1119 return `[${ name } ${ extension } ]` ;
1220}
You can’t perform that action at this time.
0 commit comments