constructs.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /**
  2. * @typedef {import('micromark-util-types').Extension} Extension
  3. */
  4. import {
  5. attention,
  6. autolink,
  7. blockQuote,
  8. characterEscape,
  9. characterReference,
  10. codeFenced,
  11. codeIndented,
  12. codeText,
  13. definition,
  14. hardBreakEscape,
  15. headingAtx,
  16. htmlFlow,
  17. htmlText,
  18. labelEnd,
  19. labelStartImage,
  20. labelStartLink,
  21. lineEnding,
  22. list,
  23. setextUnderline,
  24. thematicBreak
  25. } from 'micromark-core-commonmark'
  26. import {resolver as resolveText} from './initialize/text.js'
  27. /** @satisfies {Extension['document']} */
  28. export const document = {
  29. [42]: list,
  30. [43]: list,
  31. [45]: list,
  32. [48]: list,
  33. [49]: list,
  34. [50]: list,
  35. [51]: list,
  36. [52]: list,
  37. [53]: list,
  38. [54]: list,
  39. [55]: list,
  40. [56]: list,
  41. [57]: list,
  42. [62]: blockQuote
  43. }
  44. /** @satisfies {Extension['contentInitial']} */
  45. export const contentInitial = {
  46. [91]: definition
  47. }
  48. /** @satisfies {Extension['flowInitial']} */
  49. export const flowInitial = {
  50. [-2]: codeIndented,
  51. [-1]: codeIndented,
  52. [32]: codeIndented
  53. }
  54. /** @satisfies {Extension['flow']} */
  55. export const flow = {
  56. [35]: headingAtx,
  57. [42]: thematicBreak,
  58. [45]: [setextUnderline, thematicBreak],
  59. [60]: htmlFlow,
  60. [61]: setextUnderline,
  61. [95]: thematicBreak,
  62. [96]: codeFenced,
  63. [126]: codeFenced
  64. }
  65. /** @satisfies {Extension['string']} */
  66. export const string = {
  67. [38]: characterReference,
  68. [92]: characterEscape
  69. }
  70. /** @satisfies {Extension['text']} */
  71. export const text = {
  72. [-5]: lineEnding,
  73. [-4]: lineEnding,
  74. [-3]: lineEnding,
  75. [33]: labelStartImage,
  76. [38]: characterReference,
  77. [42]: attention,
  78. [60]: [autolink, htmlText],
  79. [91]: labelStartLink,
  80. [92]: [hardBreakEscape, characterEscape],
  81. [93]: labelEnd,
  82. [95]: attention,
  83. [96]: codeText
  84. }
  85. /** @satisfies {Extension['insideSpan']} */
  86. export const insideSpan = {
  87. null: [attention, resolveText]
  88. }
  89. /** @satisfies {Extension['attentionMarkers']} */
  90. export const attentionMarkers = {
  91. null: [42, 95]
  92. }
  93. /** @satisfies {Extension['disable']} */
  94. export const disable = {
  95. null: []
  96. }