syntax.js 617 B

123456789101112131415161718192021222324252627
  1. /**
  2. * @import {Options} from 'micromark-extension-math'
  3. * @import {Extension} from 'micromark-util-types'
  4. */
  5. import { mathFlow } from './math-flow.js';
  6. import { mathText } from './math-text.js';
  7. /**
  8. * Create an extension for `micromark` to enable math syntax.
  9. *
  10. * @param {Options | null | undefined} [options={}]
  11. * Configuration (default: `{}`).
  12. * @returns {Extension}
  13. * Extension for `micromark` that can be passed in `extensions`, to
  14. * enable math syntax.
  15. */
  16. export function math(options) {
  17. return {
  18. flow: {
  19. [36]: mathFlow
  20. },
  21. text: {
  22. [36]: mathText(options)
  23. }
  24. };
  25. }