footer.d.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * Generate the default content that GitHub uses on backreferences.
  3. *
  4. * @param {number} _
  5. * Index of the definition in the order that they are first referenced,
  6. * 0-indexed.
  7. * @param {number} rereferenceIndex
  8. * Index of calls to the same definition, 0-indexed.
  9. * @returns {Array<ElementContent>}
  10. * Content.
  11. */
  12. export function defaultFootnoteBackContent(_: number, rereferenceIndex: number): Array<ElementContent>;
  13. /**
  14. * Generate the default label that GitHub uses on backreferences.
  15. *
  16. * @param {number} referenceIndex
  17. * Index of the definition in the order that they are first referenced,
  18. * 0-indexed.
  19. * @param {number} rereferenceIndex
  20. * Index of calls to the same definition, 0-indexed.
  21. * @returns {string}
  22. * Label.
  23. */
  24. export function defaultFootnoteBackLabel(referenceIndex: number, rereferenceIndex: number): string;
  25. /**
  26. * Generate a hast footer for called footnote definitions.
  27. *
  28. * @param {State} state
  29. * Info passed around.
  30. * @returns {Element | undefined}
  31. * `section` element or `undefined`.
  32. */
  33. export function footer(state: State): Element | undefined;
  34. /**
  35. * Generate content for the backreference dynamically.
  36. *
  37. * For the following markdown:
  38. *
  39. * ```markdown
  40. * Alpha[^micromark], bravo[^micromark], and charlie[^remark].
  41. *
  42. * [^remark]: things about remark
  43. * [^micromark]: things about micromark
  44. * ```
  45. *
  46. * This function will be called with:
  47. *
  48. * * `0` and `0` for the backreference from `things about micromark` to
  49. * `alpha`, as it is the first used definition, and the first call to it
  50. * * `0` and `1` for the backreference from `things about micromark` to
  51. * `bravo`, as it is the first used definition, and the second call to it
  52. * * `1` and `0` for the backreference from `things about remark` to
  53. * `charlie`, as it is the second used definition
  54. */
  55. export type FootnoteBackContentTemplate = (referenceIndex: number, rereferenceIndex: number) => Array<ElementContent> | ElementContent | string;
  56. /**
  57. * Generate a back label dynamically.
  58. *
  59. * For the following markdown:
  60. *
  61. * ```markdown
  62. * Alpha[^micromark], bravo[^micromark], and charlie[^remark].
  63. *
  64. * [^remark]: things about remark
  65. * [^micromark]: things about micromark
  66. * ```
  67. *
  68. * This function will be called with:
  69. *
  70. * * `0` and `0` for the backreference from `things about micromark` to
  71. * `alpha`, as it is the first used definition, and the first call to it
  72. * * `0` and `1` for the backreference from `things about micromark` to
  73. * `bravo`, as it is the first used definition, and the second call to it
  74. * * `1` and `0` for the backreference from `things about remark` to
  75. * `charlie`, as it is the second used definition
  76. */
  77. export type FootnoteBackLabelTemplate = (referenceIndex: number, rereferenceIndex: number) => string;
  78. import type { ElementContent } from 'hast';
  79. import type { State } from './state.js';
  80. import type { Element } from 'hast';
  81. //# sourceMappingURL=footer.d.ts.map