MathJax-src icon indicating copy to clipboard operation
MathJax-src copied to clipboard

Dedicated interface for options

Open uetchy opened this issue 5 years ago • 2 comments

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?

uetchy avatar Jul 09 '20 11:07 uetchy

@dpvc sorry to bother but I'd like to hear opinions from you.

uetchy avatar Jul 31 '20 05:07 uetchy

I was looking for this exactly back in the day. It's a guessing game understanding the options.

ShaMan123 avatar May 24 '22 14:05 ShaMan123