index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @import {Handlers} from '../state.js'
  3. */
  4. import {blockquote} from './blockquote.js'
  5. import {hardBreak} from './break.js'
  6. import {code} from './code.js'
  7. import {strikethrough} from './delete.js'
  8. import {emphasis} from './emphasis.js'
  9. import {footnoteReference} from './footnote-reference.js'
  10. import {heading} from './heading.js'
  11. import {html} from './html.js'
  12. import {imageReference} from './image-reference.js'
  13. import {image} from './image.js'
  14. import {inlineCode} from './inline-code.js'
  15. import {linkReference} from './link-reference.js'
  16. import {link} from './link.js'
  17. import {listItem} from './list-item.js'
  18. import {list} from './list.js'
  19. import {paragraph} from './paragraph.js'
  20. import {root} from './root.js'
  21. import {strong} from './strong.js'
  22. import {table} from './table.js'
  23. import {tableRow} from './table-row.js'
  24. import {tableCell} from './table-cell.js'
  25. import {text} from './text.js'
  26. import {thematicBreak} from './thematic-break.js'
  27. /**
  28. * Default handlers for nodes.
  29. *
  30. * @satisfies {Handlers}
  31. */
  32. export const handlers = {
  33. blockquote,
  34. break: hardBreak,
  35. code,
  36. delete: strikethrough,
  37. emphasis,
  38. footnoteReference,
  39. heading,
  40. html,
  41. imageReference,
  42. image,
  43. inlineCode,
  44. linkReference,
  45. link,
  46. listItem,
  47. list,
  48. paragraph,
  49. // @ts-expect-error: root is different, but hard to type.
  50. root,
  51. strong,
  52. table,
  53. tableCell,
  54. tableRow,
  55. text,
  56. thematicBreak,
  57. toml: ignore,
  58. yaml: ignore,
  59. definition: ignore,
  60. footnoteDefinition: ignore
  61. }
  62. // Return nothing for nodes that are ignored.
  63. function ignore() {
  64. return undefined
  65. }