MathJax-src
MathJax-src copied to clipboard
Dedicated interface for options
I'm not sure this is the right place to discuss this issue, it is about the interface of SVG and CHTML class.
https://github.com/mathjax/MathJax-src/blob/b526361f6d036772491f4b521361664df44b2768/ts/output/svg.ts#L112-L115 https://github.com/mathjax/MathJax-src/blob/b526361f6d036772491f4b521361664df44b2768/ts/output/chtml.ts#L127-L130
Currently, SVG and CHTML class takes option params which are defined as OptionList.
https://github.com/mathjax/MathJax-src/blob/b526361f6d036772491f4b521361664df44b2768/ts/util/Options.ts#L40
OptionList is an object with an index signature that accepts any key and value, resulting TypeScript won't check key of a passed parameter so that it is hard for users to tell what options are available for SVG or CHTML class without seeing the document.
I've already written these interfaces for another project and feel like it should be bundled with MathJax by default. https://github.com/remarkjs/remark-math/pull/48
interface MathJaxSVGOptions {
scale: number
minScale: number
mtextInheritFont: boolean
merrorInheritFont: boolean
mathmlSpacing: boolean
skipAttributes: {[index: string]: boolean}
exFactor: number
displayAlign: 'left' | 'center' | 'right'
displayIndent: string
fontCache: 'local' | 'global'
localID: string | null
internalSpeechTitles: boolean
titleID: number
}
Is it ok to send a PR to include these interfaces?
@dpvc sorry to bother but I'd like to hear opinions from you.
I was looking for this exactly back in the day. It's a guessing game understanding the options.