index.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { SummaryPart } from "./summary";
  2. /**
  3. * Utility for loading HTML content
  4. */
  5. export { loadHtml } from "./dom";
  6. export type ToHTMLOptions = {
  7. baseDirectory: string;
  8. };
  9. export type ToHTMLFunction = (content: string, options?: ToHTMLOptions) => string;
  10. export type ToTextFunction = (content: any) => string;
  11. export type { SummaryPart };
  12. export type ParserSummary = ((content: string, options?: ToHTMLOptions) => {
  13. parts: SummaryPart[];
  14. }) & {
  15. toText: ToTextFunction;
  16. };
  17. export type ParserGlossary = ((content: string, options?: ToHTMLOptions) => string[]) & {
  18. toText: ToTextFunction;
  19. };
  20. export type ParserLangs = ((content: string, options?: ToHTMLOptions) => string[]) & {
  21. toText: ToTextFunction;
  22. };
  23. export type ParserREADME = (content: string, options?: ToHTMLOptions) => {
  24. title: string;
  25. description: string;
  26. };
  27. export type ParserPage = ((content: string, options?: ToHTMLOptions) => {
  28. content: string;
  29. }) & {
  30. prepare?: (content: string, options?: ToHTMLOptions) => string;
  31. };
  32. export type ParserInline = (content: string, options?: ToHTMLOptions) => {
  33. content: string;
  34. };
  35. export type Parsers = {
  36. summary: ParserSummary;
  37. glossary: ParserGlossary;
  38. langs: ParserLangs;
  39. readme: ParserREADME;
  40. page: ParserPage;
  41. inline: ParserInline;
  42. };
  43. declare function createParser(toHTML: any, toText?: any): Parsers;
  44. declare const defaultParser: Parsers;
  45. export { defaultParser as default, createParser };
  46. //# sourceMappingURL=index.d.ts.map