index.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import type {KatexOptions} from 'katex'
  2. export {mathHtml} from './lib/html.js'
  3. export {math} from './lib/syntax.js'
  4. /**
  5. * Configuration for HTML output.
  6. *
  7. * > 👉 **Note**: passed to `katex.renderToString`.
  8. * > `displayMode` is overwritten by this plugin, to `false` for math in
  9. * > text (inline), and `true` for math in flow (block).
  10. */
  11. export interface HtmlOptions extends KatexOptions {
  12. /**
  13. * The field `displayMode` cannot be passed to `micromark-extension-math`.
  14. * It is overwritten by it,
  15. * to `false` for math in text (inline) and `true` for math in flow (block).
  16. */
  17. displayMode?: never
  18. }
  19. /**
  20. * Configuration.
  21. */
  22. export interface Options {
  23. /**
  24. * Whether to support math (text) with a single dollar (default: `true`).
  25. *
  26. * Single dollars work in Pandoc and many other places, but often interfere
  27. * with “normal” dollars in text.
  28. * If you turn this off, you can use two or more dollars for text math.
  29. */
  30. singleDollarTextMath?: boolean | null | undefined
  31. }
  32. /**
  33. * Augment types.
  34. */
  35. declare module 'micromark-util-types' {
  36. /**
  37. * Compile data.
  38. */
  39. interface CompileData {
  40. mathFlowOpen?: boolean
  41. }
  42. /**
  43. * Token types.
  44. */
  45. interface TokenTypeMap {
  46. mathFlow: 'mathFlow'
  47. mathFlowFence: 'mathFlowFence'
  48. mathFlowFenceMeta: 'mathFlowFenceMeta'
  49. mathFlowFenceSequence: 'mathFlowFenceSequence'
  50. mathFlowValue: 'mathFlowValue'
  51. mathText: 'mathText'
  52. mathTextData: 'mathTextData'
  53. mathTextPadding: 'mathTextPadding'
  54. mathTextSequence: 'mathTextSequence'
  55. }
  56. }