@alexlit/lint-kit 107.3.0 → 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 (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 +5 -5
  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 +22 -25
  38. package/packages/config-stylelint/package.json +22 -18
  39. package/packages/config-stylelint/plugins/a11y.js +1 -1
  40. package/packages/config-stylelint/plugins/at-rule-no-children.js +1 -1
  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 +1 -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,62 +0,0 @@
1
- // Process links like https://example.org/
2
-
3
- 'use strict';
4
-
5
-
6
- // RFC3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
7
- var SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
8
-
9
-
10
- module.exports = function linkify(state, silent) {
11
- var pos, max, match, proto, link, url, fullUrl, token;
12
-
13
- if (!state.md.options.linkify) return false;
14
- if (state.linkLevel > 0) return false;
15
-
16
- pos = state.pos;
17
- max = state.posMax;
18
-
19
- if (pos + 3 > max) return false;
20
- if (state.src.charCodeAt(pos) !== 0x3A/* : */) return false;
21
- if (state.src.charCodeAt(pos + 1) !== 0x2F/* / */) return false;
22
- if (state.src.charCodeAt(pos + 2) !== 0x2F/* / */) return false;
23
-
24
- match = state.pending.match(SCHEME_RE);
25
- if (!match) return false;
26
-
27
- proto = match[1];
28
-
29
- link = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length));
30
- if (!link) return false;
31
-
32
- url = link.url;
33
-
34
- // invalid link, but still detected by linkify somehow;
35
- // need to check to prevent infinite loop below
36
- if (url.length <= proto.length) return false;
37
-
38
- // disallow '*' at the end of the link (conflicts with emphasis)
39
- url = url.replace(/\*+$/, '');
40
-
41
- fullUrl = state.md.normalizeLink(url);
42
- if (!state.md.validateLink(fullUrl)) return false;
43
-
44
- if (!silent) {
45
- state.pending = state.pending.slice(0, -proto.length);
46
-
47
- token = state.push('link_open', 'a', 1);
48
- token.attrs = [ [ 'href', fullUrl ] ];
49
- token.markup = 'linkify';
50
- token.info = 'auto';
51
-
52
- token = state.push('text', '', 0);
53
- token.content = state.md.normalizeLinkText(url);
54
-
55
- token = state.push('link_close', 'a', -1);
56
- token.markup = 'linkify';
57
- token.info = 'auto';
58
- }
59
-
60
- state.pos += url.length - proto.length;
61
- return true;
62
- };
@@ -1,46 +0,0 @@
1
- // Proceess '\n'
2
-
3
- 'use strict';
4
-
5
- var isSpace = require('../common/utils').isSpace;
6
-
7
-
8
- module.exports = function newline(state, silent) {
9
- var pmax, max, ws, pos = state.pos;
10
-
11
- if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
12
-
13
- pmax = state.pending.length - 1;
14
- max = state.posMax;
15
-
16
- // ' \n' -> hardbreak
17
- // Lookup in pending chars is bad practice! Don't copy to other rules!
18
- // Pending string is stored in concat mode, indexed lookups will cause
19
- // convertion to flat mode.
20
- if (!silent) {
21
- if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
22
- if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
23
- // Find whitespaces tail of pending chars.
24
- ws = pmax - 1;
25
- while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 0x20) ws--;
26
-
27
- state.pending = state.pending.slice(0, ws);
28
- state.push('hardbreak', 'br', 0);
29
- } else {
30
- state.pending = state.pending.slice(0, -1);
31
- state.push('softbreak', 'br', 0);
32
- }
33
-
34
- } else {
35
- state.push('softbreak', 'br', 0);
36
- }
37
- }
38
-
39
- pos++;
40
-
41
- // skip heading spaces for next line
42
- while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }
43
-
44
- state.pos = pos;
45
- return true;
46
- };
@@ -1,158 +0,0 @@
1
- // Inline parser state
2
-
3
- 'use strict';
4
-
5
-
6
- var Token = require('../token');
7
- var isWhiteSpace = require('../common/utils').isWhiteSpace;
8
- var isPunctChar = require('../common/utils').isPunctChar;
9
- var isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;
10
-
11
-
12
- function StateInline(src, md, env, outTokens) {
13
- this.src = src;
14
- this.env = env;
15
- this.md = md;
16
- this.tokens = outTokens;
17
- this.tokens_meta = Array(outTokens.length);
18
-
19
- this.pos = 0;
20
- this.posMax = this.src.length;
21
- this.level = 0;
22
- this.pending = '';
23
- this.pendingLevel = 0;
24
-
25
- // Stores { start: end } pairs. Useful for backtrack
26
- // optimization of pairs parse (emphasis, strikes).
27
- this.cache = {};
28
-
29
- // List of emphasis-like delimiters for current tag
30
- this.delimiters = [];
31
-
32
- // Stack of delimiter lists for upper level tags
33
- this._prev_delimiters = [];
34
-
35
- // backtick length => last seen position
36
- this.backticks = {};
37
- this.backticksScanned = false;
38
-
39
- // Counter used to disable inline linkify-it execution
40
- // inside <a> and markdown links
41
- this.linkLevel = 0;
42
- }
43
-
44
-
45
- // Flush pending text
46
- //
47
- StateInline.prototype.pushPending = function () {
48
- var token = new Token('text', '', 0);
49
- token.content = this.pending;
50
- token.level = this.pendingLevel;
51
- this.tokens.push(token);
52
- this.pending = '';
53
- return token;
54
- };
55
-
56
-
57
- // Push new token to "stream".
58
- // If pending text exists - flush it as text token
59
- //
60
- StateInline.prototype.push = function (type, tag, nesting) {
61
- if (this.pending) {
62
- this.pushPending();
63
- }
64
-
65
- var token = new Token(type, tag, nesting);
66
- var token_meta = null;
67
-
68
- if (nesting < 0) {
69
- // closing tag
70
- this.level--;
71
- this.delimiters = this._prev_delimiters.pop();
72
- }
73
-
74
- token.level = this.level;
75
-
76
- if (nesting > 0) {
77
- // opening tag
78
- this.level++;
79
- this._prev_delimiters.push(this.delimiters);
80
- this.delimiters = [];
81
- token_meta = { delimiters: this.delimiters };
82
- }
83
-
84
- this.pendingLevel = this.level;
85
- this.tokens.push(token);
86
- this.tokens_meta.push(token_meta);
87
- return token;
88
- };
89
-
90
-
91
- // Scan a sequence of emphasis-like markers, and determine whether
92
- // it can start an emphasis sequence or end an emphasis sequence.
93
- //
94
- // - start - position to scan from (it should point at a valid marker);
95
- // - canSplitWord - determine if these markers can be found inside a word
96
- //
97
- StateInline.prototype.scanDelims = function (start, canSplitWord) {
98
- var pos = start, lastChar, nextChar, count, can_open, can_close,
99
- isLastWhiteSpace, isLastPunctChar,
100
- isNextWhiteSpace, isNextPunctChar,
101
- left_flanking = true,
102
- right_flanking = true,
103
- max = this.posMax,
104
- marker = this.src.charCodeAt(start);
105
-
106
- // treat beginning of the line as a whitespace
107
- lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;
108
-
109
- while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
110
-
111
- count = pos - start;
112
-
113
- // treat end of the line as a whitespace
114
- nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
115
-
116
- isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
117
- isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
118
-
119
- isLastWhiteSpace = isWhiteSpace(lastChar);
120
- isNextWhiteSpace = isWhiteSpace(nextChar);
121
-
122
- if (isNextWhiteSpace) {
123
- left_flanking = false;
124
- } else if (isNextPunctChar) {
125
- if (!(isLastWhiteSpace || isLastPunctChar)) {
126
- left_flanking = false;
127
- }
128
- }
129
-
130
- if (isLastWhiteSpace) {
131
- right_flanking = false;
132
- } else if (isLastPunctChar) {
133
- if (!(isNextWhiteSpace || isNextPunctChar)) {
134
- right_flanking = false;
135
- }
136
- }
137
-
138
- if (!canSplitWord) {
139
- can_open = left_flanking && (!right_flanking || isLastPunctChar);
140
- can_close = right_flanking && (!left_flanking || isNextPunctChar);
141
- } else {
142
- can_open = left_flanking;
143
- can_close = right_flanking;
144
- }
145
-
146
- return {
147
- can_open: can_open,
148
- can_close: can_close,
149
- length: count
150
- };
151
- };
152
-
153
-
154
- // re-export Token class to use in block rules
155
- StateInline.prototype.Token = Token;
156
-
157
-
158
- module.exports = StateInline;
@@ -1,130 +0,0 @@
1
- // ~~strike through~~
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 strikethrough(state, silent) {
9
- var i, scanned, token, len, ch,
10
- start = state.pos,
11
- marker = state.src.charCodeAt(start);
12
-
13
- if (silent) { return false; }
14
-
15
- if (marker !== 0x7E/* ~ */) { return false; }
16
-
17
- scanned = state.scanDelims(state.pos, true);
18
- len = scanned.length;
19
- ch = String.fromCharCode(marker);
20
-
21
- if (len < 2) { return false; }
22
-
23
- if (len % 2) {
24
- token = state.push('text', '', 0);
25
- token.content = ch;
26
- len--;
27
- }
28
-
29
- for (i = 0; i < len; i += 2) {
30
- token = state.push('text', '', 0);
31
- token.content = ch + ch;
32
-
33
- state.delimiters.push({
34
- marker: marker,
35
- length: 0, // disable "rule of 3" length checks meant for emphasis
36
- token: state.tokens.length - 1,
37
- end: -1,
38
- open: scanned.can_open,
39
- close: scanned.can_close
40
- });
41
- }
42
-
43
- state.pos += scanned.length;
44
-
45
- return true;
46
- };
47
-
48
-
49
- function postProcess(state, delimiters) {
50
- var i, j,
51
- startDelim,
52
- endDelim,
53
- token,
54
- loneMarkers = [],
55
- max = delimiters.length;
56
-
57
- for (i = 0; i < max; i++) {
58
- startDelim = delimiters[i];
59
-
60
- if (startDelim.marker !== 0x7E/* ~ */) {
61
- continue;
62
- }
63
-
64
- if (startDelim.end === -1) {
65
- continue;
66
- }
67
-
68
- endDelim = delimiters[startDelim.end];
69
-
70
- token = state.tokens[startDelim.token];
71
- token.type = 's_open';
72
- token.tag = 's';
73
- token.nesting = 1;
74
- token.markup = '~~';
75
- token.content = '';
76
-
77
- token = state.tokens[endDelim.token];
78
- token.type = 's_close';
79
- token.tag = 's';
80
- token.nesting = -1;
81
- token.markup = '~~';
82
- token.content = '';
83
-
84
- if (state.tokens[endDelim.token - 1].type === 'text' &&
85
- state.tokens[endDelim.token - 1].content === '~') {
86
-
87
- loneMarkers.push(endDelim.token - 1);
88
- }
89
- }
90
-
91
- // If a marker sequence has an odd number of characters, it's splitted
92
- // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the
93
- // start of the sequence.
94
- //
95
- // So, we have to move all those markers after subsequent s_close tags.
96
- //
97
- while (loneMarkers.length) {
98
- i = loneMarkers.pop();
99
- j = i + 1;
100
-
101
- while (j < state.tokens.length && state.tokens[j].type === 's_close') {
102
- j++;
103
- }
104
-
105
- j--;
106
-
107
- if (i !== j) {
108
- token = state.tokens[j];
109
- state.tokens[j] = state.tokens[i];
110
- state.tokens[i] = token;
111
- }
112
- }
113
- }
114
-
115
-
116
- // Walk through delimiter list and replace text tokens with tags
117
- //
118
- module.exports.postProcess = function strikethrough(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,89 +0,0 @@
1
- // Skip text characters for text token, place those to pending buffer
2
- // and increment current pos
3
-
4
- 'use strict';
5
-
6
-
7
- // Rule to skip pure text
8
- // '{}$%@~+=:' reserved for extentions
9
-
10
- // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
11
-
12
- // !!!! Don't confuse with "Markdown ASCII Punctuation" chars
13
- // http://spec.commonmark.org/0.15/#ascii-punctuation-character
14
- function isTerminatorChar(ch) {
15
- switch (ch) {
16
- case 0x0A/* \n */:
17
- case 0x21/* ! */:
18
- case 0x23/* # */:
19
- case 0x24/* $ */:
20
- case 0x25/* % */:
21
- case 0x26/* & */:
22
- case 0x2A/* * */:
23
- case 0x2B/* + */:
24
- case 0x2D/* - */:
25
- case 0x3A/* : */:
26
- case 0x3C/* < */:
27
- case 0x3D/* = */:
28
- case 0x3E/* > */:
29
- case 0x40/* @ */:
30
- case 0x5B/* [ */:
31
- case 0x5C/* \ */:
32
- case 0x5D/* ] */:
33
- case 0x5E/* ^ */:
34
- case 0x5F/* _ */:
35
- case 0x60/* ` */:
36
- case 0x7B/* { */:
37
- case 0x7D/* } */:
38
- case 0x7E/* ~ */:
39
- return true;
40
- default:
41
- return false;
42
- }
43
- }
44
-
45
- module.exports = function text(state, silent) {
46
- var pos = state.pos;
47
-
48
- while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
49
- pos++;
50
- }
51
-
52
- if (pos === state.pos) { return false; }
53
-
54
- if (!silent) { state.pending += state.src.slice(state.pos, pos); }
55
-
56
- state.pos = pos;
57
-
58
- return true;
59
- };
60
-
61
- // Alternative implementation, for memory.
62
- //
63
- // It costs 10% of performance, but allows extend terminators list, if place it
64
- // to `ParcerInline` property. Probably, will switch to it sometime, such
65
- // flexibility required.
66
-
67
- /*
68
- var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/;
69
-
70
- module.exports = function text(state, silent) {
71
- var pos = state.pos,
72
- idx = state.src.slice(pos).search(TERMINATOR_RE);
73
-
74
- // first char is terminator -> empty text
75
- if (idx === 0) { return false; }
76
-
77
- // no terminator -> text till end of string
78
- if (idx < 0) {
79
- if (!silent) { state.pending += state.src.slice(pos); }
80
- state.pos = state.src.length;
81
- return true;
82
- }
83
-
84
- if (!silent) { state.pending += state.src.slice(pos, pos + idx); }
85
-
86
- state.pos += idx;
87
-
88
- return true;
89
- };*/
@@ -1,201 +0,0 @@
1
- // Token class
2
-
3
- 'use strict';
4
-
5
-
6
- /**
7
- * class Token
8
- **/
9
-
10
- /**
11
- * new Token(type, tag, nesting)
12
- *
13
- * Create new token and fill passed properties.
14
- **/
15
- function Token(type, tag, nesting) {
16
- /**
17
- * Token#type -> String
18
- *
19
- * Type of the token (string, e.g. "paragraph_open")
20
- **/
21
- this.type = type;
22
-
23
- /**
24
- * Token#tag -> String
25
- *
26
- * html tag name, e.g. "p"
27
- **/
28
- this.tag = tag;
29
-
30
- /**
31
- * Token#attrs -> Array
32
- *
33
- * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
34
- **/
35
- this.attrs = null;
36
-
37
- /**
38
- * Token#map -> Array
39
- *
40
- * Source map info. Format: `[ line_begin, line_end ]`
41
- **/
42
- this.map = null;
43
-
44
- /**
45
- * Token#nesting -> Number
46
- *
47
- * Level change (number in {-1, 0, 1} set), where:
48
- *
49
- * - `1` means the tag is opening
50
- * - `0` means the tag is self-closing
51
- * - `-1` means the tag is closing
52
- **/
53
- this.nesting = nesting;
54
-
55
- /**
56
- * Token#level -> Number
57
- *
58
- * nesting level, the same as `state.level`
59
- **/
60
- this.level = 0;
61
-
62
- /**
63
- * Token#children -> Array
64
- *
65
- * An array of child nodes (inline and img tokens)
66
- **/
67
- this.children = null;
68
-
69
- /**
70
- * Token#content -> String
71
- *
72
- * In a case of self-closing tag (code, html, fence, etc.),
73
- * it has contents of this tag.
74
- **/
75
- this.content = '';
76
-
77
- /**
78
- * Token#markup -> String
79
- *
80
- * '*' or '_' for emphasis, fence string for fence, etc.
81
- **/
82
- this.markup = '';
83
-
84
- /**
85
- * Token#info -> String
86
- *
87
- * Additional information:
88
- *
89
- * - Info string for "fence" tokens
90
- * - The value "auto" for autolink "link_open" and "link_close" tokens
91
- * - The string value of the item marker for ordered-list "list_item_open" tokens
92
- **/
93
- this.info = '';
94
-
95
- /**
96
- * Token#meta -> Object
97
- *
98
- * A place for plugins to store an arbitrary data
99
- **/
100
- this.meta = null;
101
-
102
- /**
103
- * Token#block -> Boolean
104
- *
105
- * True for block-level tokens, false for inline tokens.
106
- * Used in renderer to calculate line breaks
107
- **/
108
- this.block = false;
109
-
110
- /**
111
- * Token#hidden -> Boolean
112
- *
113
- * If it's true, ignore this element when rendering. Used for tight lists
114
- * to hide paragraphs.
115
- **/
116
- this.hidden = false;
117
- }
118
-
119
-
120
- /**
121
- * Token.attrIndex(name) -> Number
122
- *
123
- * Search attribute index by name.
124
- **/
125
- Token.prototype.attrIndex = function attrIndex(name) {
126
- var attrs, i, len;
127
-
128
- if (!this.attrs) { return -1; }
129
-
130
- attrs = this.attrs;
131
-
132
- for (i = 0, len = attrs.length; i < len; i++) {
133
- if (attrs[i][0] === name) { return i; }
134
- }
135
- return -1;
136
- };
137
-
138
-
139
- /**
140
- * Token.attrPush(attrData)
141
- *
142
- * Add `[ name, value ]` attribute to list. Init attrs if necessary
143
- **/
144
- Token.prototype.attrPush = function attrPush(attrData) {
145
- if (this.attrs) {
146
- this.attrs.push(attrData);
147
- } else {
148
- this.attrs = [ attrData ];
149
- }
150
- };
151
-
152
-
153
- /**
154
- * Token.attrSet(name, value)
155
- *
156
- * Set `name` attribute to `value`. Override old value if exists.
157
- **/
158
- Token.prototype.attrSet = function attrSet(name, value) {
159
- var idx = this.attrIndex(name),
160
- attrData = [ name, value ];
161
-
162
- if (idx < 0) {
163
- this.attrPush(attrData);
164
- } else {
165
- this.attrs[idx] = attrData;
166
- }
167
- };
168
-
169
-
170
- /**
171
- * Token.attrGet(name)
172
- *
173
- * Get the value of attribute `name`, or null if it does not exist.
174
- **/
175
- Token.prototype.attrGet = function attrGet(name) {
176
- var idx = this.attrIndex(name), value = null;
177
- if (idx >= 0) {
178
- value = this.attrs[idx][1];
179
- }
180
- return value;
181
- };
182
-
183
-
184
- /**
185
- * Token.attrJoin(name, value)
186
- *
187
- * Join value to existing attribute via space. Or create new attribute if not
188
- * exists. Useful to operate with token classes.
189
- **/
190
- Token.prototype.attrJoin = function attrJoin(name, value) {
191
- var idx = this.attrIndex(name);
192
-
193
- if (idx < 0) {
194
- this.attrPush([ name, value ]);
195
- } else {
196
- this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;
197
- }
198
- };
199
-
200
-
201
- module.exports = Token;