Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dedicated interface for options #524

Open
uetchy opened this issue Jul 9, 2020 · 2 comments
Open

Dedicated interface for options #524

uetchy opened this issue Jul 9, 2020 · 2 comments

Comments

@uetchy
Copy link

uetchy commented Jul 9, 2020

I'm not sure this is the right place to discuss this issue, it is about the interface of SVG and CHTML class.

constructor(options: OptionList = null) {
super(options, SVGWrapperFactory as any, TeXFont);
this.fontCache = new FontCache(this);
}

constructor(options: OptionList = null) {
super(options, CHTMLWrapperFactory as any, TeXFont);
this.font.adaptiveCSS(this.options.adaptiveCSS);
}

Currently, SVG and CHTML class takes option params which are defined as OptionList.

export type OptionList = {[name: string]: any};

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.
remarkjs/remark-math#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
Copy link
Author

uetchy commented Jul 31, 2020

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

@ShaMan123
Copy link

ShaMan123 commented May 24, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants