index.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * Parse spaces and tabs.
  3. *
  4. * There is no `nok` parameter:
  5. *
  6. * * spaces in markdown are often optional, in which case this factory can be
  7. * used and `ok` will be switched to whether spaces were found or not
  8. * * one line ending or space can be detected with `markdownSpace(code)` right
  9. * before using `factorySpace`
  10. *
  11. * ###### Examples
  12. *
  13. * Where `␉` represents a tab (plus how much it expands) and `␠` represents a
  14. * single space.
  15. *
  16. * ```markdown
  17. * ␉
  18. * ␠␠␠␠
  19. * ␉␠
  20. * ```
  21. *
  22. * @param {Effects} effects
  23. * Context.
  24. * @param {State} ok
  25. * State switched to when successful.
  26. * @param {TokenType} type
  27. * Type (`' \t'`).
  28. * @param {number | undefined} [max=Infinity]
  29. * Max (exclusive).
  30. * @returns {State}
  31. * Start state.
  32. */
  33. export function factorySpace(
  34. effects: Effects,
  35. ok: State,
  36. type: TokenType,
  37. max?: number | undefined
  38. ): State
  39. export type Effects = import('micromark-util-types').Effects
  40. export type State = import('micromark-util-types').State
  41. export type TokenType = import('micromark-util-types').TokenType