@alexlit/lint-kit 107.3.0 → 108.1.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 (247) hide show
  1. package/.eslintrc.cjs +7 -1
  2. package/.linthtmlrc.cjs +3 -1
  3. package/{.commitlintrc.cjs → commitlint.config.js} +1 -1
  4. package/package.json +6 -6
  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/index.js +12 -2
  11. package/packages/config-eslint/package.json +25 -25
  12. package/packages/config-eslint/plugins/typescript/index.js +1 -1
  13. package/packages/config-eslint/plugins/unicorn.js +2 -0
  14. package/packages/config-eslint/plugins/vue.js +34 -2
  15. package/packages/config-hooks/LICENSE +20 -0
  16. package/packages/config-hooks/README.md +18 -12
  17. package/packages/config-hooks/index.js +2 -0
  18. package/packages/config-hooks/lint-staged.js +1 -1
  19. package/packages/config-hooks/package.json +6 -5
  20. package/packages/config-htmllint/LICENSE +20 -0
  21. package/packages/config-markdownlint/LICENSE +20 -0
  22. package/packages/config-markdownlint/package.json +3 -3
  23. package/packages/config-npmlint/LICENSE +20 -0
  24. package/packages/config-npmlint/package.json +2 -2
  25. package/packages/config-prettier/LICENSE +20 -0
  26. package/packages/config-prettier/README.md +8 -3
  27. package/packages/config-prettier/index.js +14 -10
  28. package/packages/config-prettier/package.json +16 -12
  29. package/packages/config-prettier/plugins/jsdoc.js +1 -1
  30. package/packages/config-prettier/plugins/pug.js +1 -1
  31. package/packages/config-prettier/plugins/sort-json.js +1 -1
  32. package/packages/config-prettier/plugins/svelte.js +1 -1
  33. package/packages/config-prettier/plugins/tailwindcss.js +1 -1
  34. package/packages/config-prettier/plugins/xml.js +1 -1
  35. package/packages/config-stylelint/LICENSE +20 -0
  36. package/packages/config-stylelint/README.md +5 -4
  37. package/packages/config-stylelint/index.js +28 -27
  38. package/packages/config-stylelint/package.json +23 -19
  39. package/packages/config-stylelint/plugins/a11y.js +1 -1
  40. package/packages/config-stylelint/plugins/at-rule-no-children.js +2 -2
  41. package/packages/config-stylelint/plugins/color-format.js +1 -1
  42. package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +1 -1
  43. package/packages/config-stylelint/plugins/high-performance-animation.js +1 -1
  44. package/packages/config-stylelint/plugins/no-nested-media.js +1 -1
  45. package/packages/config-stylelint/plugins/no-unresolved-module.js +1 -1
  46. package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +1 -1
  47. package/packages/config-stylelint/plugins/optional/gamut.js +1 -1
  48. package/packages/config-stylelint/plugins/optional/logical-css.js +1 -1
  49. package/packages/config-stylelint/plugins/optional/no-indistinguishable-colors.js +1 -1
  50. package/packages/config-stylelint/plugins/order.js +1 -1
  51. package/packages/config-stylelint/plugins/prettier.js +1 -1
  52. package/packages/config-stylelint/plugins/scss.js +3 -1
  53. package/packages/config-stylelint/plugins/selector-no-empty.js +1 -1
  54. package/packages/config-stylelint/plugins/use-nesting.js +1 -1
  55. package/packages/config-stylelint/plugins/vue.js +1 -1
  56. package/prettier.config.js +5 -0
  57. package/stylelint.config.js +14 -0
  58. package/.huskyrc.cjs +0 -3
  59. package/.lintstagedrc.cjs +0 -3
  60. package/.prettierrc.cjs +0 -3
  61. package/.stylelintrc.cjs +0 -4
  62. package/packages/config-hooks/husky.js +0 -6
  63. package/packages/config-markdownlint/node_modules/markdown-it/LICENSE +0 -22
  64. package/packages/config-markdownlint/node_modules/markdown-it/README.md +0 -309
  65. package/packages/config-markdownlint/node_modules/markdown-it/bin/markdown-it.js +0 -117
  66. package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.js +0 -8441
  67. package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
  68. package/packages/config-markdownlint/node_modules/markdown-it/index.js +0 -4
  69. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/entities.js +0 -6
  70. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_blocks.js +0 -70
  71. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_re.js +0 -28
  72. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/utils.js +0 -317
  73. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/index.js +0 -7
  74. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_destination.js +0 -80
  75. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_label.js +0 -48
  76. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_title.js +0 -55
  77. package/packages/config-markdownlint/node_modules/markdown-it/lib/index.js +0 -582
  78. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_block.js +0 -131
  79. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_core.js +0 -61
  80. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_inline.js +0 -192
  81. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/commonmark.js +0 -81
  82. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/default.js +0 -41
  83. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/zero.js +0 -63
  84. package/packages/config-markdownlint/node_modules/markdown-it/lib/renderer.js +0 -341
  85. package/packages/config-markdownlint/node_modules/markdown-it/lib/ruler.js +0 -352
  86. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/blockquote.js +0 -226
  87. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/code.js +0 -34
  88. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/fence.js +0 -98
  89. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/heading.js +0 -55
  90. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/hr.js +0 -45
  91. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/html_block.js +0 -74
  92. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/lheading.js +0 -83
  93. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/list.js +0 -362
  94. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/paragraph.js +0 -51
  95. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/reference.js +0 -198
  96. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/state_block.js +0 -231
  97. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/table.js +0 -221
  98. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/block.js +0 -16
  99. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/inline.js +0 -13
  100. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/linkify.js +0 -142
  101. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/normalize.js +0 -21
  102. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/replacements.js +0 -105
  103. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/smartquotes.js +0 -201
  104. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/state_core.js +0 -20
  105. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/text_join.js +0 -45
  106. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/autolink.js +0 -76
  107. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/backticks.js +0 -63
  108. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/balance_pairs.js +0 -130
  109. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/emphasis.js +0 -130
  110. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/entity.js +0 -55
  111. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/escape.js +0 -71
  112. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/fragments_join.js +0 -41
  113. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/html_inline.js +0 -58
  114. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/image.js +0 -152
  115. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/link.js +0 -150
  116. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/linkify.js +0 -62
  117. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/newline.js +0 -46
  118. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/state_inline.js +0 -158
  119. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/strikethrough.js +0 -130
  120. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/text.js +0 -89
  121. package/packages/config-markdownlint/node_modules/markdown-it/lib/token.js +0 -201
  122. package/packages/config-markdownlint/node_modules/markdown-it/package.json +0 -87
  123. package/packages/config-markdownlint/node_modules/markdownlint/CHANGELOG.md +0 -428
  124. package/packages/config-markdownlint/node_modules/markdownlint/CONTRIBUTING.md +0 -92
  125. package/packages/config-markdownlint/node_modules/markdownlint/LICENSE +0 -21
  126. package/packages/config-markdownlint/node_modules/markdownlint/README.md +0 -1026
  127. package/packages/config-markdownlint/node_modules/markdownlint/demo/markdownlint-browser.js +0 -6814
  128. package/packages/config-markdownlint/node_modules/markdownlint/doc/CustomRules.md +0 -376
  129. package/packages/config-markdownlint/node_modules/markdownlint/doc/Prettier.md +0 -27
  130. package/packages/config-markdownlint/node_modules/markdownlint/doc/ReleaseProcess.md +0 -20
  131. package/packages/config-markdownlint/node_modules/markdownlint/doc/Rules.md +0 -2335
  132. package/packages/config-markdownlint/node_modules/markdownlint/doc/md001.md +0 -37
  133. package/packages/config-markdownlint/node_modules/markdownlint/doc/md003.md +0 -59
  134. package/packages/config-markdownlint/node_modules/markdownlint/doc/md004.md +0 -49
  135. package/packages/config-markdownlint/node_modules/markdownlint/doc/md005.md +0 -53
  136. package/packages/config-markdownlint/node_modules/markdownlint/doc/md007.md +0 -52
  137. package/packages/config-markdownlint/node_modules/markdownlint/doc/md009.md +0 -51
  138. package/packages/config-markdownlint/node_modules/markdownlint/doc/md010.md +0 -56
  139. package/packages/config-markdownlint/node_modules/markdownlint/doc/md011.md +0 -30
  140. package/packages/config-markdownlint/node_modules/markdownlint/doc/md012.md +0 -38
  141. package/packages/config-markdownlint/node_modules/markdownlint/doc/md013.md +0 -57
  142. package/packages/config-markdownlint/node_modules/markdownlint/doc/md014.md +0 -54
  143. package/packages/config-markdownlint/node_modules/markdownlint/doc/md018.md +0 -27
  144. package/packages/config-markdownlint/node_modules/markdownlint/doc/md019.md +0 -28
  145. package/packages/config-markdownlint/node_modules/markdownlint/doc/md020.md +0 -29
  146. package/packages/config-markdownlint/node_modules/markdownlint/doc/md021.md +0 -31
  147. package/packages/config-markdownlint/node_modules/markdownlint/doc/md022.md +0 -52
  148. package/packages/config-markdownlint/node_modules/markdownlint/doc/md023.md +0 -33
  149. package/packages/config-markdownlint/node_modules/markdownlint/doc/md024.md +0 -47
  150. package/packages/config-markdownlint/node_modules/markdownlint/doc/md025.md +0 -49
  151. package/packages/config-markdownlint/node_modules/markdownlint/doc/md026.md +0 -40
  152. package/packages/config-markdownlint/node_modules/markdownlint/doc/md027.md +0 -24
  153. package/packages/config-markdownlint/node_modules/markdownlint/doc/md028.md +0 -40
  154. package/packages/config-markdownlint/node_modules/markdownlint/doc/md029.md +0 -98
  155. package/packages/config-markdownlint/node_modules/markdownlint/doc/md030.md +0 -82
  156. package/packages/config-markdownlint/node_modules/markdownlint/doc/md031.md +0 -50
  157. package/packages/config-markdownlint/node_modules/markdownlint/doc/md032.md +0 -55
  158. package/packages/config-markdownlint/node_modules/markdownlint/doc/md033.md +0 -27
  159. package/packages/config-markdownlint/node_modules/markdownlint/doc/md034.md +0 -50
  160. package/packages/config-markdownlint/node_modules/markdownlint/doc/md035.md +0 -42
  161. package/packages/config-markdownlint/node_modules/markdownlint/doc/md036.md +0 -45
  162. package/packages/config-markdownlint/node_modules/markdownlint/doc/md037.md +0 -37
  163. package/packages/config-markdownlint/node_modules/markdownlint/doc/md038.md +0 -40
  164. package/packages/config-markdownlint/node_modules/markdownlint/doc/md039.md +0 -21
  165. package/packages/config-markdownlint/node_modules/markdownlint/doc/md040.md +0 -52
  166. package/packages/config-markdownlint/node_modules/markdownlint/doc/md041.md +0 -49
  167. package/packages/config-markdownlint/node_modules/markdownlint/doc/md042.md +0 -32
  168. package/packages/config-markdownlint/node_modules/markdownlint/doc/md043.md +0 -69
  169. package/packages/config-markdownlint/node_modules/markdownlint/doc/md044.md +0 -35
  170. package/packages/config-markdownlint/node_modules/markdownlint/doc/md045.md +0 -40
  171. package/packages/config-markdownlint/node_modules/markdownlint/doc/md046.md +0 -40
  172. package/packages/config-markdownlint/node_modules/markdownlint/doc/md047.md +0 -34
  173. package/packages/config-markdownlint/node_modules/markdownlint/doc/md048.md +0 -41
  174. package/packages/config-markdownlint/node_modules/markdownlint/doc/md049.md +0 -32
  175. package/packages/config-markdownlint/node_modules/markdownlint/doc/md050.md +0 -32
  176. package/packages/config-markdownlint/node_modules/markdownlint/doc/md051.md +0 -61
  177. package/packages/config-markdownlint/node_modules/markdownlint/doc/md052.md +0 -40
  178. package/packages/config-markdownlint/node_modules/markdownlint/doc/md053.md +0 -38
  179. package/packages/config-markdownlint/node_modules/markdownlint/doc/md054.md +0 -100
  180. package/packages/config-markdownlint/node_modules/markdownlint/helpers/LICENSE +0 -21
  181. package/packages/config-markdownlint/node_modules/markdownlint/helpers/README.md +0 -70
  182. package/packages/config-markdownlint/node_modules/markdownlint/helpers/helpers.js +0 -1025
  183. package/packages/config-markdownlint/node_modules/markdownlint/helpers/micromark.cjs +0 -426
  184. package/packages/config-markdownlint/node_modules/markdownlint/helpers/package.json +0 -26
  185. package/packages/config-markdownlint/node_modules/markdownlint/helpers/shared.js +0 -10
  186. package/packages/config-markdownlint/node_modules/markdownlint/lib/cache.js +0 -21
  187. package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration.d.ts +0 -1152
  188. package/packages/config-markdownlint/node_modules/markdownlint/lib/constants.js +0 -14
  189. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.d.ts +0 -406
  190. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.js +0 -1476
  191. package/packages/config-markdownlint/node_modules/markdownlint/lib/md001.js +0 -22
  192. package/packages/config-markdownlint/node_modules/markdownlint/lib/md003.js +0 -42
  193. package/packages/config-markdownlint/node_modules/markdownlint/lib/md004.js +0 -76
  194. package/packages/config-markdownlint/node_modules/markdownlint/lib/md005.js +0 -73
  195. package/packages/config-markdownlint/node_modules/markdownlint/lib/md007.js +0 -86
  196. package/packages/config-markdownlint/node_modules/markdownlint/lib/md009.js +0 -86
  197. package/packages/config-markdownlint/node_modules/markdownlint/lib/md010.js +0 -60
  198. package/packages/config-markdownlint/node_modules/markdownlint/lib/md011.js +0 -46
  199. package/packages/config-markdownlint/node_modules/markdownlint/lib/md012.js +0 -32
  200. package/packages/config-markdownlint/node_modules/markdownlint/lib/md013.js +0 -96
  201. package/packages/config-markdownlint/node_modules/markdownlint/lib/md014.js +0 -53
  202. package/packages/config-markdownlint/node_modules/markdownlint/lib/md018.js +0 -34
  203. package/packages/config-markdownlint/node_modules/markdownlint/lib/md019.js +0 -39
  204. package/packages/config-markdownlint/node_modules/markdownlint/lib/md020.js +0 -62
  205. package/packages/config-markdownlint/node_modules/markdownlint/lib/md021.js +0 -62
  206. package/packages/config-markdownlint/node_modules/markdownlint/lib/md022.js +0 -108
  207. package/packages/config-markdownlint/node_modules/markdownlint/lib/md023.js +0 -38
  208. package/packages/config-markdownlint/node_modules/markdownlint/lib/md024.js +0 -38
  209. package/packages/config-markdownlint/node_modules/markdownlint/lib/md025.js +0 -32
  210. package/packages/config-markdownlint/node_modules/markdownlint/lib/md026.js +0 -50
  211. package/packages/config-markdownlint/node_modules/markdownlint/lib/md027.js +0 -56
  212. package/packages/config-markdownlint/node_modules/markdownlint/lib/md028.js +0 -30
  213. package/packages/config-markdownlint/node_modules/markdownlint/lib/md029.js +0 -67
  214. package/packages/config-markdownlint/node_modules/markdownlint/lib/md030.js +0 -61
  215. package/packages/config-markdownlint/node_modules/markdownlint/lib/md031.js +0 -40
  216. package/packages/config-markdownlint/node_modules/markdownlint/lib/md032.js +0 -78
  217. package/packages/config-markdownlint/node_modules/markdownlint/lib/md033.js +0 -39
  218. package/packages/config-markdownlint/node_modules/markdownlint/lib/md034.js +0 -79
  219. package/packages/config-markdownlint/node_modules/markdownlint/lib/md035.js +0 -24
  220. package/packages/config-markdownlint/node_modules/markdownlint/lib/md036.js +0 -56
  221. package/packages/config-markdownlint/node_modules/markdownlint/lib/md037.js +0 -91
  222. package/packages/config-markdownlint/node_modules/markdownlint/lib/md038.js +0 -97
  223. package/packages/config-markdownlint/node_modules/markdownlint/lib/md039.js +0 -67
  224. package/packages/config-markdownlint/node_modules/markdownlint/lib/md040.js +0 -37
  225. package/packages/config-markdownlint/node_modules/markdownlint/lib/md041.js +0 -42
  226. package/packages/config-markdownlint/node_modules/markdownlint/lib/md042.js +0 -49
  227. package/packages/config-markdownlint/node_modules/markdownlint/lib/md043.js +0 -64
  228. package/packages/config-markdownlint/node_modules/markdownlint/lib/md044.js +0 -107
  229. package/packages/config-markdownlint/node_modules/markdownlint/lib/md045.js +0 -60
  230. package/packages/config-markdownlint/node_modules/markdownlint/lib/md046.js +0 -33
  231. package/packages/config-markdownlint/node_modules/markdownlint/lib/md047.js +0 -28
  232. package/packages/config-markdownlint/node_modules/markdownlint/lib/md048.js +0 -30
  233. package/packages/config-markdownlint/node_modules/markdownlint/lib/md049-md050.js +0 -89
  234. package/packages/config-markdownlint/node_modules/markdownlint/lib/md051.js +0 -172
  235. package/packages/config-markdownlint/node_modules/markdownlint/lib/md052.js +0 -39
  236. package/packages/config-markdownlint/node_modules/markdownlint/lib/md053.js +0 -59
  237. package/packages/config-markdownlint/node_modules/markdownlint/lib/md054.js +0 -125
  238. package/packages/config-markdownlint/node_modules/markdownlint/lib/rules.js +0 -65
  239. package/packages/config-markdownlint/node_modules/markdownlint/package.json +0 -109
  240. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.jsonc +0 -297
  241. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.yaml +0 -266
  242. package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema.json +0 -1762
  243. package/packages/config-markdownlint/node_modules/markdownlint/style/all.json +0 -5
  244. package/packages/config-markdownlint/node_modules/markdownlint/style/cirosantilli.json +0 -22
  245. package/packages/config-markdownlint/node_modules/markdownlint/style/prettier.json +0 -26
  246. package/packages/config-markdownlint/node_modules/markdownlint/style/relaxed.json +0 -12
  247. /package/packages/config-eslint/plugins/{security.js → optional/security.js} +0 -0
@@ -1,362 +0,0 @@
1
- // Lists
2
-
3
- 'use strict';
4
-
5
- var isSpace = require('../common/utils').isSpace;
6
-
7
-
8
- // Search `[-+*][\n ]`, returns next pos after marker on success
9
- // or -1 on fail.
10
- function skipBulletListMarker(state, startLine) {
11
- var marker, pos, max, ch;
12
-
13
- pos = state.bMarks[startLine] + state.tShift[startLine];
14
- max = state.eMarks[startLine];
15
-
16
- marker = state.src.charCodeAt(pos++);
17
- // Check bullet
18
- if (marker !== 0x2A/* * */ &&
19
- marker !== 0x2D/* - */ &&
20
- marker !== 0x2B/* + */) {
21
- return -1;
22
- }
23
-
24
- if (pos < max) {
25
- ch = state.src.charCodeAt(pos);
26
-
27
- if (!isSpace(ch)) {
28
- // " -test " - is not a list item
29
- return -1;
30
- }
31
- }
32
-
33
- return pos;
34
- }
35
-
36
- // Search `\d+[.)][\n ]`, returns next pos after marker on success
37
- // or -1 on fail.
38
- function skipOrderedListMarker(state, startLine) {
39
- var ch,
40
- start = state.bMarks[startLine] + state.tShift[startLine],
41
- pos = start,
42
- max = state.eMarks[startLine];
43
-
44
- // List marker should have at least 2 chars (digit + dot)
45
- if (pos + 1 >= max) { return -1; }
46
-
47
- ch = state.src.charCodeAt(pos++);
48
-
49
- if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }
50
-
51
- for (;;) {
52
- // EOL -> fail
53
- if (pos >= max) { return -1; }
54
-
55
- ch = state.src.charCodeAt(pos++);
56
-
57
- if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
58
-
59
- // List marker should have no more than 9 digits
60
- // (prevents integer overflow in browsers)
61
- if (pos - start >= 10) { return -1; }
62
-
63
- continue;
64
- }
65
-
66
- // found valid marker
67
- if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {
68
- break;
69
- }
70
-
71
- return -1;
72
- }
73
-
74
-
75
- if (pos < max) {
76
- ch = state.src.charCodeAt(pos);
77
-
78
- if (!isSpace(ch)) {
79
- // " 1.test " - is not a list item
80
- return -1;
81
- }
82
- }
83
- return pos;
84
- }
85
-
86
- function markTightParagraphs(state, idx) {
87
- var i, l,
88
- level = state.level + 2;
89
-
90
- for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
91
- if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
92
- state.tokens[i + 2].hidden = true;
93
- state.tokens[i].hidden = true;
94
- i += 2;
95
- }
96
- }
97
- }
98
-
99
-
100
- module.exports = function list(state, startLine, endLine, silent) {
101
- var ch,
102
- contentStart,
103
- i,
104
- indent,
105
- indentAfterMarker,
106
- initial,
107
- isOrdered,
108
- itemLines,
109
- l,
110
- listLines,
111
- listTokIdx,
112
- markerCharCode,
113
- markerValue,
114
- max,
115
- offset,
116
- oldListIndent,
117
- oldParentType,
118
- oldSCount,
119
- oldTShift,
120
- oldTight,
121
- pos,
122
- posAfterMarker,
123
- prevEmptyEnd,
124
- start,
125
- terminate,
126
- terminatorRules,
127
- token,
128
- nextLine = startLine,
129
- isTerminatingParagraph = false,
130
- tight = true;
131
-
132
- // if it's indented more than 3 spaces, it should be a code block
133
- if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }
134
-
135
- // Special case:
136
- // - item 1
137
- // - item 2
138
- // - item 3
139
- // - item 4
140
- // - this one is a paragraph continuation
141
- if (state.listIndent >= 0 &&
142
- state.sCount[nextLine] - state.listIndent >= 4 &&
143
- state.sCount[nextLine] < state.blkIndent) {
144
- return false;
145
- }
146
-
147
- // limit conditions when list can interrupt
148
- // a paragraph (validation mode only)
149
- if (silent && state.parentType === 'paragraph') {
150
- // Next list item should still terminate previous list item;
151
- //
152
- // This code can fail if plugins use blkIndent as well as lists,
153
- // but I hope the spec gets fixed long before that happens.
154
- //
155
- if (state.sCount[nextLine] >= state.blkIndent) {
156
- isTerminatingParagraph = true;
157
- }
158
- }
159
-
160
- // Detect list type and position after marker
161
- if ((posAfterMarker = skipOrderedListMarker(state, nextLine)) >= 0) {
162
- isOrdered = true;
163
- start = state.bMarks[nextLine] + state.tShift[nextLine];
164
- markerValue = Number(state.src.slice(start, posAfterMarker - 1));
165
-
166
- // If we're starting a new ordered list right after
167
- // a paragraph, it should start with 1.
168
- if (isTerminatingParagraph && markerValue !== 1) return false;
169
-
170
- } else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) {
171
- isOrdered = false;
172
-
173
- } else {
174
- return false;
175
- }
176
-
177
- // If we're starting a new unordered list right after
178
- // a paragraph, first line should not be empty.
179
- if (isTerminatingParagraph) {
180
- if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine]) return false;
181
- }
182
-
183
- // For validation mode we can terminate immediately
184
- if (silent) { return true; }
185
-
186
- // We should terminate list on style change. Remember first one to compare.
187
- markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
188
-
189
- // Start list
190
- listTokIdx = state.tokens.length;
191
-
192
- if (isOrdered) {
193
- token = state.push('ordered_list_open', 'ol', 1);
194
- if (markerValue !== 1) {
195
- token.attrs = [ [ 'start', markerValue ] ];
196
- }
197
-
198
- } else {
199
- token = state.push('bullet_list_open', 'ul', 1);
200
- }
201
-
202
- token.map = listLines = [ nextLine, 0 ];
203
- token.markup = String.fromCharCode(markerCharCode);
204
-
205
- //
206
- // Iterate list items
207
- //
208
-
209
- prevEmptyEnd = false;
210
- terminatorRules = state.md.block.ruler.getRules('list');
211
-
212
- oldParentType = state.parentType;
213
- state.parentType = 'list';
214
-
215
- while (nextLine < endLine) {
216
- pos = posAfterMarker;
217
- max = state.eMarks[nextLine];
218
-
219
- initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine]);
220
-
221
- while (pos < max) {
222
- ch = state.src.charCodeAt(pos);
223
-
224
- if (ch === 0x09) {
225
- offset += 4 - (offset + state.bsCount[nextLine]) % 4;
226
- } else if (ch === 0x20) {
227
- offset++;
228
- } else {
229
- break;
230
- }
231
-
232
- pos++;
233
- }
234
-
235
- contentStart = pos;
236
-
237
- if (contentStart >= max) {
238
- // trimming space in "- \n 3" case, indent is 1 here
239
- indentAfterMarker = 1;
240
- } else {
241
- indentAfterMarker = offset - initial;
242
- }
243
-
244
- // If we have more than 4 spaces, the indent is 1
245
- // (the rest is just indented code block)
246
- if (indentAfterMarker > 4) { indentAfterMarker = 1; }
247
-
248
- // " - test"
249
- // ^^^^^ - calculating total length of this thing
250
- indent = initial + indentAfterMarker;
251
-
252
- // Run subparser & write tokens
253
- token = state.push('list_item_open', 'li', 1);
254
- token.markup = String.fromCharCode(markerCharCode);
255
- token.map = itemLines = [ nextLine, 0 ];
256
- if (isOrdered) {
257
- token.info = state.src.slice(start, posAfterMarker - 1);
258
- }
259
-
260
- // change current state, then restore it after parser subcall
261
- oldTight = state.tight;
262
- oldTShift = state.tShift[nextLine];
263
- oldSCount = state.sCount[nextLine];
264
-
265
- // - example list
266
- // ^ listIndent position will be here
267
- // ^ blkIndent position will be here
268
- //
269
- oldListIndent = state.listIndent;
270
- state.listIndent = state.blkIndent;
271
- state.blkIndent = indent;
272
-
273
- state.tight = true;
274
- state.tShift[nextLine] = contentStart - state.bMarks[nextLine];
275
- state.sCount[nextLine] = offset;
276
-
277
- if (contentStart >= max && state.isEmpty(nextLine + 1)) {
278
- // workaround for this case
279
- // (list item is empty, list terminates before "foo"):
280
- // ~~~~~~~~
281
- // -
282
- //
283
- // foo
284
- // ~~~~~~~~
285
- state.line = Math.min(state.line + 2, endLine);
286
- } else {
287
- state.md.block.tokenize(state, nextLine, endLine, true);
288
- }
289
-
290
- // If any of list item is tight, mark list as tight
291
- if (!state.tight || prevEmptyEnd) {
292
- tight = false;
293
- }
294
- // Item become loose if finish with empty line,
295
- // but we should filter last element, because it means list finish
296
- prevEmptyEnd = (state.line - nextLine) > 1 && state.isEmpty(state.line - 1);
297
-
298
- state.blkIndent = state.listIndent;
299
- state.listIndent = oldListIndent;
300
- state.tShift[nextLine] = oldTShift;
301
- state.sCount[nextLine] = oldSCount;
302
- state.tight = oldTight;
303
-
304
- token = state.push('list_item_close', 'li', -1);
305
- token.markup = String.fromCharCode(markerCharCode);
306
-
307
- nextLine = state.line;
308
- itemLines[1] = nextLine;
309
-
310
- if (nextLine >= endLine) { break; }
311
-
312
- //
313
- // Try to check if list is terminated or continued.
314
- //
315
- if (state.sCount[nextLine] < state.blkIndent) { break; }
316
-
317
- // if it's indented more than 3 spaces, it should be a code block
318
- if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }
319
-
320
- // fail if terminating block found
321
- terminate = false;
322
- for (i = 0, l = terminatorRules.length; i < l; i++) {
323
- if (terminatorRules[i](state, nextLine, endLine, true)) {
324
- terminate = true;
325
- break;
326
- }
327
- }
328
- if (terminate) { break; }
329
-
330
- // fail if list has another type
331
- if (isOrdered) {
332
- posAfterMarker = skipOrderedListMarker(state, nextLine);
333
- if (posAfterMarker < 0) { break; }
334
- start = state.bMarks[nextLine] + state.tShift[nextLine];
335
- } else {
336
- posAfterMarker = skipBulletListMarker(state, nextLine);
337
- if (posAfterMarker < 0) { break; }
338
- }
339
-
340
- if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }
341
- }
342
-
343
- // Finalize list
344
- if (isOrdered) {
345
- token = state.push('ordered_list_close', 'ol', -1);
346
- } else {
347
- token = state.push('bullet_list_close', 'ul', -1);
348
- }
349
- token.markup = String.fromCharCode(markerCharCode);
350
-
351
- listLines[1] = nextLine;
352
- state.line = nextLine;
353
-
354
- state.parentType = oldParentType;
355
-
356
- // mark paragraphs tight if needed
357
- if (tight) {
358
- markTightParagraphs(state, listTokIdx);
359
- }
360
-
361
- return true;
362
- };
@@ -1,51 +0,0 @@
1
- // Paragraph
2
-
3
- 'use strict';
4
-
5
-
6
- module.exports = function paragraph(state, startLine, endLine) {
7
- var content, terminate, i, l, token, oldParentType,
8
- nextLine = startLine + 1,
9
- terminatorRules = state.md.block.ruler.getRules('paragraph');
10
-
11
- oldParentType = state.parentType;
12
- state.parentType = 'paragraph';
13
-
14
- // jump line-by-line until empty one or EOF
15
- for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
16
- // this would be a code block normally, but after paragraph
17
- // it's considered a lazy continuation regardless of what's there
18
- if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
19
-
20
- // quirk for blockquotes, this line should already be checked by that rule
21
- if (state.sCount[nextLine] < 0) { continue; }
22
-
23
- // Some tags can terminate paragraph without empty line.
24
- terminate = false;
25
- for (i = 0, l = terminatorRules.length; i < l; i++) {
26
- if (terminatorRules[i](state, nextLine, endLine, true)) {
27
- terminate = true;
28
- break;
29
- }
30
- }
31
- if (terminate) { break; }
32
- }
33
-
34
- content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
35
-
36
- state.line = nextLine;
37
-
38
- token = state.push('paragraph_open', 'p', 1);
39
- token.map = [ startLine, state.line ];
40
-
41
- token = state.push('inline', '', 0);
42
- token.content = content;
43
- token.map = [ startLine, state.line ];
44
- token.children = [];
45
-
46
- token = state.push('paragraph_close', 'p', -1);
47
-
48
- state.parentType = oldParentType;
49
-
50
- return true;
51
- };
@@ -1,198 +0,0 @@
1
- 'use strict';
2
-
3
-
4
- var normalizeReference = require('../common/utils').normalizeReference;
5
- var isSpace = require('../common/utils').isSpace;
6
-
7
-
8
- module.exports = function reference(state, startLine, _endLine, silent) {
9
- var ch,
10
- destEndPos,
11
- destEndLineNo,
12
- endLine,
13
- href,
14
- i,
15
- l,
16
- label,
17
- labelEnd,
18
- oldParentType,
19
- res,
20
- start,
21
- str,
22
- terminate,
23
- terminatorRules,
24
- title,
25
- lines = 0,
26
- pos = state.bMarks[startLine] + state.tShift[startLine],
27
- max = state.eMarks[startLine],
28
- nextLine = startLine + 1;
29
-
30
- // if it's indented more than 3 spaces, it should be a code block
31
- if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
32
-
33
- if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }
34
-
35
- // Simple check to quickly interrupt scan on [link](url) at the start of line.
36
- // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54
37
- while (++pos < max) {
38
- if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&
39
- state.src.charCodeAt(pos - 1) !== 0x5C/* \ */) {
40
- if (pos + 1 === max) { return false; }
41
- if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }
42
- break;
43
- }
44
- }
45
-
46
- endLine = state.lineMax;
47
-
48
- // jump line-by-line until empty one or EOF
49
- terminatorRules = state.md.block.ruler.getRules('reference');
50
-
51
- oldParentType = state.parentType;
52
- state.parentType = 'reference';
53
-
54
- for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
55
- // this would be a code block normally, but after paragraph
56
- // it's considered a lazy continuation regardless of what's there
57
- if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
58
-
59
- // quirk for blockquotes, this line should already be checked by that rule
60
- if (state.sCount[nextLine] < 0) { continue; }
61
-
62
- // Some tags can terminate paragraph without empty line.
63
- terminate = false;
64
- for (i = 0, l = terminatorRules.length; i < l; i++) {
65
- if (terminatorRules[i](state, nextLine, endLine, true)) {
66
- terminate = true;
67
- break;
68
- }
69
- }
70
- if (terminate) { break; }
71
- }
72
-
73
- str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
74
- max = str.length;
75
-
76
- for (pos = 1; pos < max; pos++) {
77
- ch = str.charCodeAt(pos);
78
- if (ch === 0x5B /* [ */) {
79
- return false;
80
- } else if (ch === 0x5D /* ] */) {
81
- labelEnd = pos;
82
- break;
83
- } else if (ch === 0x0A /* \n */) {
84
- lines++;
85
- } else if (ch === 0x5C /* \ */) {
86
- pos++;
87
- if (pos < max && str.charCodeAt(pos) === 0x0A) {
88
- lines++;
89
- }
90
- }
91
- }
92
-
93
- if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }
94
-
95
- // [label]: destination 'title'
96
- // ^^^ skip optional whitespace here
97
- for (pos = labelEnd + 2; pos < max; pos++) {
98
- ch = str.charCodeAt(pos);
99
- if (ch === 0x0A) {
100
- lines++;
101
- } else if (isSpace(ch)) {
102
- /*eslint no-empty:0*/
103
- } else {
104
- break;
105
- }
106
- }
107
-
108
- // [label]: destination 'title'
109
- // ^^^^^^^^^^^ parse this
110
- res = state.md.helpers.parseLinkDestination(str, pos, max);
111
- if (!res.ok) { return false; }
112
-
113
- href = state.md.normalizeLink(res.str);
114
- if (!state.md.validateLink(href)) { return false; }
115
-
116
- pos = res.pos;
117
- lines += res.lines;
118
-
119
- // save cursor state, we could require to rollback later
120
- destEndPos = pos;
121
- destEndLineNo = lines;
122
-
123
- // [label]: destination 'title'
124
- // ^^^ skipping those spaces
125
- start = pos;
126
- for (; pos < max; pos++) {
127
- ch = str.charCodeAt(pos);
128
- if (ch === 0x0A) {
129
- lines++;
130
- } else if (isSpace(ch)) {
131
- /*eslint no-empty:0*/
132
- } else {
133
- break;
134
- }
135
- }
136
-
137
- // [label]: destination 'title'
138
- // ^^^^^^^ parse this
139
- res = state.md.helpers.parseLinkTitle(str, pos, max);
140
- if (pos < max && start !== pos && res.ok) {
141
- title = res.str;
142
- pos = res.pos;
143
- lines += res.lines;
144
- } else {
145
- title = '';
146
- pos = destEndPos;
147
- lines = destEndLineNo;
148
- }
149
-
150
- // skip trailing spaces until the rest of the line
151
- while (pos < max) {
152
- ch = str.charCodeAt(pos);
153
- if (!isSpace(ch)) { break; }
154
- pos++;
155
- }
156
-
157
- if (pos < max && str.charCodeAt(pos) !== 0x0A) {
158
- if (title) {
159
- // garbage at the end of the line after title,
160
- // but it could still be a valid reference if we roll back
161
- title = '';
162
- pos = destEndPos;
163
- lines = destEndLineNo;
164
- while (pos < max) {
165
- ch = str.charCodeAt(pos);
166
- if (!isSpace(ch)) { break; }
167
- pos++;
168
- }
169
- }
170
- }
171
-
172
- if (pos < max && str.charCodeAt(pos) !== 0x0A) {
173
- // garbage at the end of the line
174
- return false;
175
- }
176
-
177
- label = normalizeReference(str.slice(1, labelEnd));
178
- if (!label) {
179
- // CommonMark 0.20 disallows empty labels
180
- return false;
181
- }
182
-
183
- // Reference can not terminate anything. This check is for safety only.
184
- /*istanbul ignore if*/
185
- if (silent) { return true; }
186
-
187
- if (typeof state.env.references === 'undefined') {
188
- state.env.references = {};
189
- }
190
- if (typeof state.env.references[label] === 'undefined') {
191
- state.env.references[label] = { title: title, href: href };
192
- }
193
-
194
- state.parentType = oldParentType;
195
-
196
- state.line = startLine + lines + 1;
197
- return true;
198
- };