@alexlit/lint-kit 107.2.2 → 108.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/.eslintrc.cjs +9 -0
  2. package/.linthtmlrc.cjs +5 -0
  3. package/{.commitlintrc.js → commitlint.config.js} +1 -1
  4. package/package.json +11 -10
  5. package/packages/config-commitlint/LICENSE +20 -0
  6. package/packages/config-commitlint/README.md +5 -9
  7. package/packages/config-commitlint/index.js +1 -1
  8. package/packages/config-commitlint/package.json +4 -3
  9. package/packages/config-eslint/LICENSE +20 -0
  10. package/packages/config-eslint/dictionaries/index.js +2 -1
  11. package/packages/config-eslint/index.js +14 -3
  12. package/packages/config-eslint/package.json +25 -25
  13. package/packages/config-eslint/plugins/typescript/index.js +1 -1
  14. package/packages/config-eslint/plugins/unicorn.js +2 -0
  15. package/packages/config-eslint/plugins/vue.js +34 -2
  16. package/packages/config-hooks/LICENSE +20 -0
  17. package/packages/config-hooks/README.md +18 -12
  18. package/packages/config-hooks/index.js +2 -0
  19. package/packages/config-hooks/lint-staged.js +4 -4
  20. package/packages/config-hooks/package.json +6 -5
  21. package/packages/config-htmllint/LICENSE +20 -0
  22. package/packages/config-markdownlint/LICENSE +20 -0
  23. package/packages/config-markdownlint/README.md +5 -5
  24. package/packages/config-markdownlint/index.json +17 -0
  25. package/packages/config-markdownlint/package.json +5 -5
  26. package/packages/config-npmlint/LICENSE +20 -0
  27. package/packages/config-npmlint/package.json +2 -2
  28. package/packages/config-prettier/LICENSE +20 -0
  29. package/packages/config-prettier/README.md +8 -3
  30. package/packages/config-prettier/index.js +14 -10
  31. package/packages/config-prettier/package.json +16 -12
  32. package/packages/config-prettier/plugins/jsdoc.js +1 -1
  33. package/packages/config-prettier/plugins/pug.js +1 -1
  34. package/packages/config-prettier/plugins/sort-json.js +1 -1
  35. package/packages/config-prettier/plugins/svelte.js +1 -1
  36. package/packages/config-prettier/plugins/tailwindcss.js +1 -1
  37. package/packages/config-prettier/plugins/xml.js +1 -1
  38. package/packages/config-stylelint/LICENSE +20 -0
  39. package/packages/config-stylelint/README.md +5 -4
  40. package/packages/config-stylelint/index.js +22 -25
  41. package/packages/config-stylelint/package.json +22 -18
  42. package/packages/config-stylelint/plugins/a11y.js +1 -1
  43. package/packages/config-stylelint/plugins/at-rule-no-children.js +1 -1
  44. package/packages/config-stylelint/plugins/color-format.js +1 -1
  45. package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +1 -1
  46. package/packages/config-stylelint/plugins/high-performance-animation.js +1 -1
  47. package/packages/config-stylelint/plugins/no-nested-media.js +1 -1
  48. package/packages/config-stylelint/plugins/no-unresolved-module.js +1 -1
  49. package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +1 -1
  50. package/packages/config-stylelint/plugins/optional/gamut.js +1 -1
  51. package/packages/config-stylelint/plugins/optional/logical-css.js +1 -1
  52. package/packages/config-stylelint/plugins/optional/no-indistinguishable-colors.js +1 -1
  53. package/packages/config-stylelint/plugins/order.js +1 -1
  54. package/packages/config-stylelint/plugins/prettier.js +1 -1
  55. package/packages/config-stylelint/plugins/scss.js +1 -1
  56. package/packages/config-stylelint/plugins/selector-no-empty.js +1 -1
  57. package/packages/config-stylelint/plugins/use-nesting.js +1 -1
  58. package/packages/config-stylelint/plugins/vue.js +1 -1
  59. package/prettier.config.js +5 -0
  60. package/scripts/lint.eslint.sh +1 -1
  61. package/scripts/lint.markdownlint.sh +1 -1
  62. package/stylelint.config.js +14 -0
  63. package/.eslintrc.js +0 -3
  64. package/.huskyrc.js +0 -3
  65. package/.linthtmlrc.js +0 -3
  66. package/.lintstagedrc.js +0 -3
  67. package/.markdownlintrc.js +0 -3
  68. package/.prettierrc.js +0 -3
  69. package/.stylelintrc.js +0 -4
  70. package/packages/config-hooks/husky.js +0 -6
  71. package/packages/config-markdownlint/index.js +0 -17
  72. package/packages/config-markdownlint/node_modules/markdown-it/LICENSE +0 -22
  73. package/packages/config-markdownlint/node_modules/markdown-it/README.md +0 -309
  74. package/packages/config-markdownlint/node_modules/markdown-it/bin/markdown-it.js +0 -117
  75. package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.js +0 -8441
  76. package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
  77. package/packages/config-markdownlint/node_modules/markdown-it/index.js +0 -4
  78. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/entities.js +0 -6
  79. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_blocks.js +0 -70
  80. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_re.js +0 -28
  81. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/utils.js +0 -317
  82. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/index.js +0 -7
  83. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_destination.js +0 -80
  84. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_label.js +0 -48
  85. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_title.js +0 -55
  86. package/packages/config-markdownlint/node_modules/markdown-it/lib/index.js +0 -582
  87. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_block.js +0 -131
  88. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_core.js +0 -61
  89. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_inline.js +0 -192
  90. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/commonmark.js +0 -81
  91. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/default.js +0 -41
  92. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/zero.js +0 -63
  93. package/packages/config-markdownlint/node_modules/markdown-it/lib/renderer.js +0 -341
  94. package/packages/config-markdownlint/node_modules/markdown-it/lib/ruler.js +0 -352
  95. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/blockquote.js +0 -226
  96. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/code.js +0 -34
  97. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/fence.js +0 -98
  98. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/heading.js +0 -55
  99. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/hr.js +0 -45
  100. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/html_block.js +0 -74
  101. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/lheading.js +0 -83
  102. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/list.js +0 -362
  103. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/paragraph.js +0 -51
  104. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/reference.js +0 -198
  105. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/state_block.js +0 -231
  106. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/table.js +0 -221
  107. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/block.js +0 -16
  108. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/inline.js +0 -13
  109. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/linkify.js +0 -142
  110. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/normalize.js +0 -21
  111. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/replacements.js +0 -105
  112. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/smartquotes.js +0 -201
  113. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/state_core.js +0 -20
  114. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/text_join.js +0 -45
  115. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/autolink.js +0 -76
  116. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/backticks.js +0 -63
  117. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/balance_pairs.js +0 -130
  118. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/emphasis.js +0 -130
  119. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/entity.js +0 -55
  120. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/escape.js +0 -71
  121. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/fragments_join.js +0 -41
  122. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/html_inline.js +0 -58
  123. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/image.js +0 -152
  124. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/link.js +0 -150
  125. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/linkify.js +0 -62
  126. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/newline.js +0 -46
  127. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/state_inline.js +0 -158
  128. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/strikethrough.js +0 -130
  129. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/text.js +0 -89
  130. package/packages/config-markdownlint/node_modules/markdown-it/lib/token.js +0 -201
  131. package/packages/config-markdownlint/node_modules/markdown-it/package.json +0 -87
  132. package/packages/config-markdownlint/node_modules/markdownlint/CHANGELOG.md +0 -428
  133. package/packages/config-markdownlint/node_modules/markdownlint/CONTRIBUTING.md +0 -92
  134. package/packages/config-markdownlint/node_modules/markdownlint/LICENSE +0 -21
  135. package/packages/config-markdownlint/node_modules/markdownlint/README.md +0 -1026
  136. package/packages/config-markdownlint/node_modules/markdownlint/demo/markdownlint-browser.js +0 -6814
  137. package/packages/config-markdownlint/node_modules/markdownlint/doc/CustomRules.md +0 -376
  138. package/packages/config-markdownlint/node_modules/markdownlint/doc/Prettier.md +0 -27
  139. package/packages/config-markdownlint/node_modules/markdownlint/doc/ReleaseProcess.md +0 -20
  140. package/packages/config-markdownlint/node_modules/markdownlint/doc/Rules.md +0 -2335
  141. package/packages/config-markdownlint/node_modules/markdownlint/doc/md001.md +0 -37
  142. package/packages/config-markdownlint/node_modules/markdownlint/doc/md003.md +0 -59
  143. package/packages/config-markdownlint/node_modules/markdownlint/doc/md004.md +0 -49
  144. package/packages/config-markdownlint/node_modules/markdownlint/doc/md005.md +0 -53
  145. package/packages/config-markdownlint/node_modules/markdownlint/doc/md007.md +0 -52
  146. package/packages/config-markdownlint/node_modules/markdownlint/doc/md009.md +0 -51
  147. package/packages/config-markdownlint/node_modules/markdownlint/doc/md010.md +0 -56
  148. package/packages/config-markdownlint/node_modules/markdownlint/doc/md011.md +0 -30
  149. package/packages/config-markdownlint/node_modules/markdownlint/doc/md012.md +0 -38
  150. package/packages/config-markdownlint/node_modules/markdownlint/doc/md013.md +0 -57
  151. package/packages/config-markdownlint/node_modules/markdownlint/doc/md014.md +0 -54
  152. package/packages/config-markdownlint/node_modules/markdownlint/doc/md018.md +0 -27
  153. package/packages/config-markdownlint/node_modules/markdownlint/doc/md019.md +0 -28
  154. package/packages/config-markdownlint/node_modules/markdownlint/doc/md020.md +0 -29
  155. package/packages/config-markdownlint/node_modules/markdownlint/doc/md021.md +0 -31
  156. package/packages/config-markdownlint/node_modules/markdownlint/doc/md022.md +0 -52
  157. package/packages/config-markdownlint/node_modules/markdownlint/doc/md023.md +0 -33
  158. package/packages/config-markdownlint/node_modules/markdownlint/doc/md024.md +0 -47
  159. package/packages/config-markdownlint/node_modules/markdownlint/doc/md025.md +0 -49
  160. package/packages/config-markdownlint/node_modules/markdownlint/doc/md026.md +0 -40
  161. package/packages/config-markdownlint/node_modules/markdownlint/doc/md027.md +0 -24
  162. package/packages/config-markdownlint/node_modules/markdownlint/doc/md028.md +0 -40
  163. package/packages/config-markdownlint/node_modules/markdownlint/doc/md029.md +0 -98
  164. package/packages/config-markdownlint/node_modules/markdownlint/doc/md030.md +0 -82
  165. package/packages/config-markdownlint/node_modules/markdownlint/doc/md031.md +0 -50
  166. package/packages/config-markdownlint/node_modules/markdownlint/doc/md032.md +0 -55
  167. package/packages/config-markdownlint/node_modules/markdownlint/doc/md033.md +0 -27
  168. package/packages/config-markdownlint/node_modules/markdownlint/doc/md034.md +0 -50
  169. package/packages/config-markdownlint/node_modules/markdownlint/doc/md035.md +0 -42
  170. package/packages/config-markdownlint/node_modules/markdownlint/doc/md036.md +0 -45
  171. package/packages/config-markdownlint/node_modules/markdownlint/doc/md037.md +0 -37
  172. package/packages/config-markdownlint/node_modules/markdownlint/doc/md038.md +0 -40
  173. package/packages/config-markdownlint/node_modules/markdownlint/doc/md039.md +0 -21
  174. package/packages/config-markdownlint/node_modules/markdownlint/doc/md040.md +0 -52
  175. package/packages/config-markdownlint/node_modules/markdownlint/doc/md041.md +0 -49
  176. package/packages/config-markdownlint/node_modules/markdownlint/doc/md042.md +0 -32
  177. package/packages/config-markdownlint/node_modules/markdownlint/doc/md043.md +0 -69
  178. package/packages/config-markdownlint/node_modules/markdownlint/doc/md044.md +0 -35
  179. package/packages/config-markdownlint/node_modules/markdownlint/doc/md045.md +0 -40
  180. package/packages/config-markdownlint/node_modules/markdownlint/doc/md046.md +0 -40
  181. package/packages/config-markdownlint/node_modules/markdownlint/doc/md047.md +0 -34
  182. package/packages/config-markdownlint/node_modules/markdownlint/doc/md048.md +0 -41
  183. package/packages/config-markdownlint/node_modules/markdownlint/doc/md049.md +0 -32
  184. package/packages/config-markdownlint/node_modules/markdownlint/doc/md050.md +0 -32
  185. package/packages/config-markdownlint/node_modules/markdownlint/doc/md051.md +0 -61
  186. package/packages/config-markdownlint/node_modules/markdownlint/doc/md052.md +0 -40
  187. package/packages/config-markdownlint/node_modules/markdownlint/doc/md053.md +0 -38
  188. package/packages/config-markdownlint/node_modules/markdownlint/doc/md054.md +0 -100
  189. package/packages/config-markdownlint/node_modules/markdownlint/helpers/LICENSE +0 -21
  190. package/packages/config-markdownlint/node_modules/markdownlint/helpers/README.md +0 -70
  191. package/packages/config-markdownlint/node_modules/markdownlint/helpers/helpers.js +0 -1025
  192. package/packages/config-markdownlint/node_modules/markdownlint/helpers/micromark.cjs +0 -426
  193. package/packages/config-markdownlint/node_modules/markdownlint/helpers/package.json +0 -26
  194. package/packages/config-markdownlint/node_modules/markdownlint/helpers/shared.js +0 -10
  195. package/packages/config-markdownlint/node_modules/markdownlint/lib/cache.js +0 -21
  196. package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration.d.ts +0 -1152
  197. package/packages/config-markdownlint/node_modules/markdownlint/lib/constants.js +0 -14
  198. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.d.ts +0 -406
  199. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.js +0 -1476
  200. package/packages/config-markdownlint/node_modules/markdownlint/lib/md001.js +0 -22
  201. package/packages/config-markdownlint/node_modules/markdownlint/lib/md003.js +0 -42
  202. package/packages/config-markdownlint/node_modules/markdownlint/lib/md004.js +0 -76
  203. package/packages/config-markdownlint/node_modules/markdownlint/lib/md005.js +0 -73
  204. package/packages/config-markdownlint/node_modules/markdownlint/lib/md007.js +0 -86
  205. package/packages/config-markdownlint/node_modules/markdownlint/lib/md009.js +0 -86
  206. package/packages/config-markdownlint/node_modules/markdownlint/lib/md010.js +0 -60
  207. package/packages/config-markdownlint/node_modules/markdownlint/lib/md011.js +0 -46
  208. package/packages/config-markdownlint/node_modules/markdownlint/lib/md012.js +0 -32
  209. package/packages/config-markdownlint/node_modules/markdownlint/lib/md013.js +0 -96
  210. package/packages/config-markdownlint/node_modules/markdownlint/lib/md014.js +0 -53
  211. package/packages/config-markdownlint/node_modules/markdownlint/lib/md018.js +0 -34
  212. package/packages/config-markdownlint/node_modules/markdownlint/lib/md019.js +0 -39
  213. package/packages/config-markdownlint/node_modules/markdownlint/lib/md020.js +0 -62
  214. package/packages/config-markdownlint/node_modules/markdownlint/lib/md021.js +0 -62
  215. package/packages/config-markdownlint/node_modules/markdownlint/lib/md022.js +0 -108
  216. package/packages/config-markdownlint/node_modules/markdownlint/lib/md023.js +0 -38
  217. package/packages/config-markdownlint/node_modules/markdownlint/lib/md024.js +0 -38
  218. package/packages/config-markdownlint/node_modules/markdownlint/lib/md025.js +0 -32
  219. package/packages/config-markdownlint/node_modules/markdownlint/lib/md026.js +0 -50
  220. package/packages/config-markdownlint/node_modules/markdownlint/lib/md027.js +0 -56
  221. package/packages/config-markdownlint/node_modules/markdownlint/lib/md028.js +0 -30
  222. package/packages/config-markdownlint/node_modules/markdownlint/lib/md029.js +0 -67
  223. package/packages/config-markdownlint/node_modules/markdownlint/lib/md030.js +0 -61
  224. package/packages/config-markdownlint/node_modules/markdownlint/lib/md031.js +0 -40
  225. package/packages/config-markdownlint/node_modules/markdownlint/lib/md032.js +0 -78
  226. package/packages/config-markdownlint/node_modules/markdownlint/lib/md033.js +0 -39
  227. package/packages/config-markdownlint/node_modules/markdownlint/lib/md034.js +0 -79
  228. package/packages/config-markdownlint/node_modules/markdownlint/lib/md035.js +0 -24
  229. package/packages/config-markdownlint/node_modules/markdownlint/lib/md036.js +0 -56
  230. package/packages/config-markdownlint/node_modules/markdownlint/lib/md037.js +0 -91
  231. package/packages/config-markdownlint/node_modules/markdownlint/lib/md038.js +0 -97
  232. package/packages/config-markdownlint/node_modules/markdownlint/lib/md039.js +0 -67
  233. package/packages/config-markdownlint/node_modules/markdownlint/lib/md040.js +0 -37
  234. package/packages/config-markdownlint/node_modules/markdownlint/lib/md041.js +0 -42
  235. package/packages/config-markdownlint/node_modules/markdownlint/lib/md042.js +0 -49
  236. package/packages/config-markdownlint/node_modules/markdownlint/lib/md043.js +0 -64
  237. package/packages/config-markdownlint/node_modules/markdownlint/lib/md044.js +0 -107
  238. package/packages/config-markdownlint/node_modules/markdownlint/lib/md045.js +0 -60
  239. package/packages/config-markdownlint/node_modules/markdownlint/lib/md046.js +0 -33
  240. package/packages/config-markdownlint/node_modules/markdownlint/lib/md047.js +0 -28
  241. package/packages/config-markdownlint/node_modules/markdownlint/lib/md048.js +0 -30
  242. package/packages/config-markdownlint/node_modules/markdownlint/lib/md049-md050.js +0 -89
  243. package/packages/config-markdownlint/node_modules/markdownlint/lib/md051.js +0 -172
  244. package/packages/config-markdownlint/node_modules/markdownlint/lib/md052.js +0 -39
  245. package/packages/config-markdownlint/node_modules/markdownlint/lib/md053.js +0 -59
  246. package/packages/config-markdownlint/node_modules/markdownlint/lib/md054.js +0 -125
  247. package/packages/config-markdownlint/node_modules/markdownlint/lib/rules.js +0 -65
  248. package/packages/config-markdownlint/node_modules/markdownlint/package.json +0 -109
  249. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.jsonc +0 -297
  250. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.yaml +0 -266
  251. package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema.json +0 -1762
  252. package/packages/config-markdownlint/node_modules/markdownlint/style/all.json +0 -5
  253. package/packages/config-markdownlint/node_modules/markdownlint/style/cirosantilli.json +0 -22
  254. package/packages/config-markdownlint/node_modules/markdownlint/style/prettier.json +0 -26
  255. package/packages/config-markdownlint/node_modules/markdownlint/style/relaxed.json +0 -12
  256. /package/packages/config-eslint/plugins/{security.js → optional/security.js} +0 -0
@@ -1,130 +0,0 @@
1
- // Process *this* and _that_
2
- //
3
- 'use strict';
4
-
5
-
6
- // Insert each marker as a separate text token, and add it to delimiter list
7
- //
8
- module.exports.tokenize = function emphasis(state, silent) {
9
- var i, scanned, token,
10
- start = state.pos,
11
- marker = state.src.charCodeAt(start);
12
-
13
- if (silent) { return false; }
14
-
15
- if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }
16
-
17
- scanned = state.scanDelims(state.pos, marker === 0x2A);
18
-
19
- for (i = 0; i < scanned.length; i++) {
20
- token = state.push('text', '', 0);
21
- token.content = String.fromCharCode(marker);
22
-
23
- state.delimiters.push({
24
- // Char code of the starting marker (number).
25
- //
26
- marker: marker,
27
-
28
- // Total length of these series of delimiters.
29
- //
30
- length: scanned.length,
31
-
32
- // A position of the token this delimiter corresponds to.
33
- //
34
- token: state.tokens.length - 1,
35
-
36
- // If this delimiter is matched as a valid opener, `end` will be
37
- // equal to its position, otherwise it's `-1`.
38
- //
39
- end: -1,
40
-
41
- // Boolean flags that determine if this delimiter could open or close
42
- // an emphasis.
43
- //
44
- open: scanned.can_open,
45
- close: scanned.can_close
46
- });
47
- }
48
-
49
- state.pos += scanned.length;
50
-
51
- return true;
52
- };
53
-
54
-
55
- function postProcess(state, delimiters) {
56
- var i,
57
- startDelim,
58
- endDelim,
59
- token,
60
- ch,
61
- isStrong,
62
- max = delimiters.length;
63
-
64
- for (i = max - 1; i >= 0; i--) {
65
- startDelim = delimiters[i];
66
-
67
- if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {
68
- continue;
69
- }
70
-
71
- // Process only opening markers
72
- if (startDelim.end === -1) {
73
- continue;
74
- }
75
-
76
- endDelim = delimiters[startDelim.end];
77
-
78
- // If the previous delimiter has the same marker and is adjacent to this one,
79
- // merge those into one strong delimiter.
80
- //
81
- // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`
82
- //
83
- isStrong = i > 0 &&
84
- delimiters[i - 1].end === startDelim.end + 1 &&
85
- // check that first two markers match and adjacent
86
- delimiters[i - 1].marker === startDelim.marker &&
87
- delimiters[i - 1].token === startDelim.token - 1 &&
88
- // check that last two markers are adjacent (we can safely assume they match)
89
- delimiters[startDelim.end + 1].token === endDelim.token + 1;
90
-
91
- ch = String.fromCharCode(startDelim.marker);
92
-
93
- token = state.tokens[startDelim.token];
94
- token.type = isStrong ? 'strong_open' : 'em_open';
95
- token.tag = isStrong ? 'strong' : 'em';
96
- token.nesting = 1;
97
- token.markup = isStrong ? ch + ch : ch;
98
- token.content = '';
99
-
100
- token = state.tokens[endDelim.token];
101
- token.type = isStrong ? 'strong_close' : 'em_close';
102
- token.tag = isStrong ? 'strong' : 'em';
103
- token.nesting = -1;
104
- token.markup = isStrong ? ch + ch : ch;
105
- token.content = '';
106
-
107
- if (isStrong) {
108
- state.tokens[delimiters[i - 1].token].content = '';
109
- state.tokens[delimiters[startDelim.end + 1].token].content = '';
110
- i--;
111
- }
112
- }
113
- }
114
-
115
-
116
- // Walk through delimiter list and replace text tokens with tags
117
- //
118
- module.exports.postProcess = function emphasis(state) {
119
- var curr,
120
- tokens_meta = state.tokens_meta,
121
- max = state.tokens_meta.length;
122
-
123
- postProcess(state, state.delimiters);
124
-
125
- for (curr = 0; curr < max; curr++) {
126
- if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
127
- postProcess(state, tokens_meta[curr].delimiters);
128
- }
129
- }
130
- };
@@ -1,55 +0,0 @@
1
- // Process html entity - &#123;, &#xAF;, &quot;, ...
2
-
3
- 'use strict';
4
-
5
- var entities = require('../common/entities');
6
- var has = require('../common/utils').has;
7
- var isValidEntityCode = require('../common/utils').isValidEntityCode;
8
- var fromCodePoint = require('../common/utils').fromCodePoint;
9
-
10
-
11
- var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
12
- var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
13
-
14
-
15
- module.exports = function entity(state, silent) {
16
- var ch, code, match, token, pos = state.pos, max = state.posMax;
17
-
18
- if (state.src.charCodeAt(pos) !== 0x26/* & */) return false;
19
-
20
- if (pos + 1 >= max) return false;
21
-
22
- ch = state.src.charCodeAt(pos + 1);
23
-
24
- if (ch === 0x23 /* # */) {
25
- match = state.src.slice(pos).match(DIGITAL_RE);
26
- if (match) {
27
- if (!silent) {
28
- code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
29
-
30
- token = state.push('text_special', '', 0);
31
- token.content = isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
32
- token.markup = match[0];
33
- token.info = 'entity';
34
- }
35
- state.pos += match[0].length;
36
- return true;
37
- }
38
- } else {
39
- match = state.src.slice(pos).match(NAMED_RE);
40
- if (match) {
41
- if (has(entities, match[1])) {
42
- if (!silent) {
43
- token = state.push('text_special', '', 0);
44
- token.content = entities[match[1]];
45
- token.markup = match[0];
46
- token.info = 'entity';
47
- }
48
- state.pos += match[0].length;
49
- return true;
50
- }
51
- }
52
- }
53
-
54
- return false;
55
- };
@@ -1,71 +0,0 @@
1
- // Process escaped chars and hardbreaks
2
-
3
- 'use strict';
4
-
5
- var isSpace = require('../common/utils').isSpace;
6
-
7
- var ESCAPED = [];
8
-
9
- for (var i = 0; i < 256; i++) { ESCAPED.push(0); }
10
-
11
- '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
12
- .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });
13
-
14
-
15
- module.exports = function escape(state, silent) {
16
- var ch1, ch2, origStr, escapedStr, token, pos = state.pos, max = state.posMax;
17
-
18
- if (state.src.charCodeAt(pos) !== 0x5C/* \ */) return false;
19
- pos++;
20
-
21
- // '\' at the end of the inline block
22
- if (pos >= max) return false;
23
-
24
- ch1 = state.src.charCodeAt(pos);
25
-
26
- if (ch1 === 0x0A) {
27
- if (!silent) {
28
- state.push('hardbreak', 'br', 0);
29
- }
30
-
31
- pos++;
32
- // skip leading whitespaces from next line
33
- while (pos < max) {
34
- ch1 = state.src.charCodeAt(pos);
35
- if (!isSpace(ch1)) break;
36
- pos++;
37
- }
38
-
39
- state.pos = pos;
40
- return true;
41
- }
42
-
43
- escapedStr = state.src[pos];
44
-
45
- if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {
46
- ch2 = state.src.charCodeAt(pos + 1);
47
-
48
- if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
49
- escapedStr += state.src[pos + 1];
50
- pos++;
51
- }
52
- }
53
-
54
- origStr = '\\' + escapedStr;
55
-
56
- if (!silent) {
57
- token = state.push('text_special', '', 0);
58
-
59
- if (ch1 < 256 && ESCAPED[ch1] !== 0) {
60
- token.content = escapedStr;
61
- } else {
62
- token.content = origStr;
63
- }
64
-
65
- token.markup = origStr;
66
- token.info = 'escape';
67
- }
68
-
69
- state.pos = pos + 1;
70
- return true;
71
- };
@@ -1,41 +0,0 @@
1
- // Clean up tokens after emphasis and strikethrough postprocessing:
2
- // merge adjacent text nodes into one and re-calculate all token levels
3
- //
4
- // This is necessary because initially emphasis delimiter markers (*, _, ~)
5
- // are treated as their own separate text tokens. Then emphasis rule either
6
- // leaves them as text (needed to merge with adjacent text) or turns them
7
- // into opening/closing tags (which messes up levels inside).
8
- //
9
- 'use strict';
10
-
11
-
12
- module.exports = function fragments_join(state) {
13
- var curr, last,
14
- level = 0,
15
- tokens = state.tokens,
16
- max = state.tokens.length;
17
-
18
- for (curr = last = 0; curr < max; curr++) {
19
- // re-calculate levels after emphasis/strikethrough turns some text nodes
20
- // into opening/closing tags
21
- if (tokens[curr].nesting < 0) level--; // closing tag
22
- tokens[curr].level = level;
23
- if (tokens[curr].nesting > 0) level++; // opening tag
24
-
25
- if (tokens[curr].type === 'text' &&
26
- curr + 1 < max &&
27
- tokens[curr + 1].type === 'text') {
28
-
29
- // collapse two adjacent text nodes
30
- tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
31
- } else {
32
- if (curr !== last) { tokens[last] = tokens[curr]; }
33
-
34
- last++;
35
- }
36
- }
37
-
38
- if (curr !== last) {
39
- tokens.length = last;
40
- }
41
- };
@@ -1,58 +0,0 @@
1
- // Process html tags
2
-
3
- 'use strict';
4
-
5
-
6
- var HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;
7
-
8
-
9
- function isLinkOpen(str) {
10
- return /^<a[>\s]/i.test(str);
11
- }
12
- function isLinkClose(str) {
13
- return /^<\/a\s*>/i.test(str);
14
- }
15
-
16
-
17
- function isLetter(ch) {
18
- /*eslint no-bitwise:0*/
19
- var lc = ch | 0x20; // to lower case
20
- return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
21
- }
22
-
23
-
24
- module.exports = function html_inline(state, silent) {
25
- var ch, match, max, token,
26
- pos = state.pos;
27
-
28
- if (!state.md.options.html) { return false; }
29
-
30
- // Check start
31
- max = state.posMax;
32
- if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||
33
- pos + 2 >= max) {
34
- return false;
35
- }
36
-
37
- // Quick fail on second char
38
- ch = state.src.charCodeAt(pos + 1);
39
- if (ch !== 0x21/* ! */ &&
40
- ch !== 0x3F/* ? */ &&
41
- ch !== 0x2F/* / */ &&
42
- !isLetter(ch)) {
43
- return false;
44
- }
45
-
46
- match = state.src.slice(pos).match(HTML_TAG_RE);
47
- if (!match) { return false; }
48
-
49
- if (!silent) {
50
- token = state.push('html_inline', '', 0);
51
- token.content = match[0];
52
-
53
- if (isLinkOpen(token.content)) state.linkLevel++;
54
- if (isLinkClose(token.content)) state.linkLevel--;
55
- }
56
- state.pos += match[0].length;
57
- return true;
58
- };
@@ -1,152 +0,0 @@
1
- // Process ![image](<src> "title")
2
-
3
- 'use strict';
4
-
5
- var normalizeReference = require('../common/utils').normalizeReference;
6
- var isSpace = require('../common/utils').isSpace;
7
-
8
-
9
- module.exports = function image(state, silent) {
10
- var attrs,
11
- code,
12
- content,
13
- label,
14
- labelEnd,
15
- labelStart,
16
- pos,
17
- ref,
18
- res,
19
- title,
20
- token,
21
- tokens,
22
- start,
23
- href = '',
24
- oldPos = state.pos,
25
- max = state.posMax;
26
-
27
- if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }
28
- if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }
29
-
30
- labelStart = state.pos + 2;
31
- labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
32
-
33
- // parser failed to find ']', so it's not a valid link
34
- if (labelEnd < 0) { return false; }
35
-
36
- pos = labelEnd + 1;
37
- if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
38
- //
39
- // Inline link
40
- //
41
-
42
- // [link]( <href> "title" )
43
- // ^^ skipping these spaces
44
- pos++;
45
- for (; pos < max; pos++) {
46
- code = state.src.charCodeAt(pos);
47
- if (!isSpace(code) && code !== 0x0A) { break; }
48
- }
49
- if (pos >= max) { return false; }
50
-
51
- // [link]( <href> "title" )
52
- // ^^^^^^ parsing link destination
53
- start = pos;
54
- res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
55
- if (res.ok) {
56
- href = state.md.normalizeLink(res.str);
57
- if (state.md.validateLink(href)) {
58
- pos = res.pos;
59
- } else {
60
- href = '';
61
- }
62
- }
63
-
64
- // [link]( <href> "title" )
65
- // ^^ skipping these spaces
66
- start = pos;
67
- for (; pos < max; pos++) {
68
- code = state.src.charCodeAt(pos);
69
- if (!isSpace(code) && code !== 0x0A) { break; }
70
- }
71
-
72
- // [link]( <href> "title" )
73
- // ^^^^^^^ parsing link title
74
- res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
75
- if (pos < max && start !== pos && res.ok) {
76
- title = res.str;
77
- pos = res.pos;
78
-
79
- // [link]( <href> "title" )
80
- // ^^ skipping these spaces
81
- for (; pos < max; pos++) {
82
- code = state.src.charCodeAt(pos);
83
- if (!isSpace(code) && code !== 0x0A) { break; }
84
- }
85
- } else {
86
- title = '';
87
- }
88
-
89
- if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
90
- state.pos = oldPos;
91
- return false;
92
- }
93
- pos++;
94
- } else {
95
- //
96
- // Link reference
97
- //
98
- if (typeof state.env.references === 'undefined') { return false; }
99
-
100
- if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
101
- start = pos + 1;
102
- pos = state.md.helpers.parseLinkLabel(state, pos);
103
- if (pos >= 0) {
104
- label = state.src.slice(start, pos++);
105
- } else {
106
- pos = labelEnd + 1;
107
- }
108
- } else {
109
- pos = labelEnd + 1;
110
- }
111
-
112
- // covers label === '' and label === undefined
113
- // (collapsed reference link and shortcut reference link respectively)
114
- if (!label) { label = state.src.slice(labelStart, labelEnd); }
115
-
116
- ref = state.env.references[normalizeReference(label)];
117
- if (!ref) {
118
- state.pos = oldPos;
119
- return false;
120
- }
121
- href = ref.href;
122
- title = ref.title;
123
- }
124
-
125
- //
126
- // We found the end of the link, and know for a fact it's a valid link;
127
- // so all that's left to do is to call tokenizer.
128
- //
129
- if (!silent) {
130
- content = state.src.slice(labelStart, labelEnd);
131
-
132
- state.md.inline.parse(
133
- content,
134
- state.md,
135
- state.env,
136
- tokens = []
137
- );
138
-
139
- token = state.push('image', 'img', 0);
140
- token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];
141
- token.children = tokens;
142
- token.content = content;
143
-
144
- if (title) {
145
- attrs.push([ 'title', title ]);
146
- }
147
- }
148
-
149
- state.pos = pos;
150
- state.posMax = max;
151
- return true;
152
- };
@@ -1,150 +0,0 @@
1
- // Process [link](<to> "stuff")
2
-
3
- 'use strict';
4
-
5
- var normalizeReference = require('../common/utils').normalizeReference;
6
- var isSpace = require('../common/utils').isSpace;
7
-
8
-
9
- module.exports = function link(state, silent) {
10
- var attrs,
11
- code,
12
- label,
13
- labelEnd,
14
- labelStart,
15
- pos,
16
- res,
17
- ref,
18
- token,
19
- href = '',
20
- title = '',
21
- oldPos = state.pos,
22
- max = state.posMax,
23
- start = state.pos,
24
- parseReference = true;
25
-
26
- if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }
27
-
28
- labelStart = state.pos + 1;
29
- labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
30
-
31
- // parser failed to find ']', so it's not a valid link
32
- if (labelEnd < 0) { return false; }
33
-
34
- pos = labelEnd + 1;
35
- if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
36
- //
37
- // Inline link
38
- //
39
-
40
- // might have found a valid shortcut link, disable reference parsing
41
- parseReference = false;
42
-
43
- // [link]( <href> "title" )
44
- // ^^ skipping these spaces
45
- pos++;
46
- for (; pos < max; pos++) {
47
- code = state.src.charCodeAt(pos);
48
- if (!isSpace(code) && code !== 0x0A) { break; }
49
- }
50
- if (pos >= max) { return false; }
51
-
52
- // [link]( <href> "title" )
53
- // ^^^^^^ parsing link destination
54
- start = pos;
55
- res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
56
- if (res.ok) {
57
- href = state.md.normalizeLink(res.str);
58
- if (state.md.validateLink(href)) {
59
- pos = res.pos;
60
- } else {
61
- href = '';
62
- }
63
-
64
- // [link]( <href> "title" )
65
- // ^^ skipping these spaces
66
- start = pos;
67
- for (; pos < max; pos++) {
68
- code = state.src.charCodeAt(pos);
69
- if (!isSpace(code) && code !== 0x0A) { break; }
70
- }
71
-
72
- // [link]( <href> "title" )
73
- // ^^^^^^^ parsing link title
74
- res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
75
- if (pos < max && start !== pos && res.ok) {
76
- title = res.str;
77
- pos = res.pos;
78
-
79
- // [link]( <href> "title" )
80
- // ^^ skipping these spaces
81
- for (; pos < max; pos++) {
82
- code = state.src.charCodeAt(pos);
83
- if (!isSpace(code) && code !== 0x0A) { break; }
84
- }
85
- }
86
- }
87
-
88
- if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
89
- // parsing a valid shortcut link failed, fallback to reference
90
- parseReference = true;
91
- }
92
- pos++;
93
- }
94
-
95
- if (parseReference) {
96
- //
97
- // Link reference
98
- //
99
- if (typeof state.env.references === 'undefined') { return false; }
100
-
101
- if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
102
- start = pos + 1;
103
- pos = state.md.helpers.parseLinkLabel(state, pos);
104
- if (pos >= 0) {
105
- label = state.src.slice(start, pos++);
106
- } else {
107
- pos = labelEnd + 1;
108
- }
109
- } else {
110
- pos = labelEnd + 1;
111
- }
112
-
113
- // covers label === '' and label === undefined
114
- // (collapsed reference link and shortcut reference link respectively)
115
- if (!label) { label = state.src.slice(labelStart, labelEnd); }
116
-
117
- ref = state.env.references[normalizeReference(label)];
118
- if (!ref) {
119
- state.pos = oldPos;
120
- return false;
121
- }
122
- href = ref.href;
123
- title = ref.title;
124
- }
125
-
126
- //
127
- // We found the end of the link, and know for a fact it's a valid link;
128
- // so all that's left to do is to call tokenizer.
129
- //
130
- if (!silent) {
131
- state.pos = labelStart;
132
- state.posMax = labelEnd;
133
-
134
- token = state.push('link_open', 'a', 1);
135
- token.attrs = attrs = [ [ 'href', href ] ];
136
- if (title) {
137
- attrs.push([ 'title', title ]);
138
- }
139
-
140
- state.linkLevel++;
141
- state.md.inline.tokenize(state);
142
- state.linkLevel--;
143
-
144
- token = state.push('link_close', 'a', -1);
145
- }
146
-
147
- state.pos = pos;
148
- state.posMax = max;
149
- return true;
150
- };