block-parser.d.ts 813 B

123456789101112131415161718192021222324
  1. import { Line } from '../primitives.js';
  2. /**
  3. * Groups source lines in sections representing tags.
  4. * First section is a block description if present. Last section captures lines starting with
  5. * the last tag to the end of the block, including dangling closing marker.
  6. * @param {Line[]} block souce lines making a single comment block
  7. */
  8. export type Parser = (block: Line[]) => Line[][];
  9. /**
  10. * Predicate telling if string contains opening/closing escaping sequence
  11. * @param {string} source raw source line
  12. */
  13. export type Fencer = (source: string) => boolean;
  14. /**
  15. * `Parser` configuration options
  16. */
  17. export interface Options {
  18. fence: string | Fencer;
  19. }
  20. /**
  21. * Creates configured `Parser`
  22. * @param {Partial<Options>} options
  23. */
  24. export default function getParser({ fence, }?: Partial<Options>): Parser;