@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.
- package/.eslintrc.cjs +7 -1
- package/.linthtmlrc.cjs +3 -1
- package/{.commitlintrc.cjs → commitlint.config.js} +1 -1
- package/package.json +6 -6
- package/packages/config-commitlint/LICENSE +20 -0
- package/packages/config-commitlint/README.md +5 -9
- package/packages/config-commitlint/index.js +1 -1
- package/packages/config-commitlint/package.json +4 -3
- package/packages/config-eslint/LICENSE +20 -0
- package/packages/config-eslint/index.js +12 -2
- package/packages/config-eslint/package.json +25 -25
- package/packages/config-eslint/plugins/typescript/index.js +1 -1
- package/packages/config-eslint/plugins/unicorn.js +2 -0
- package/packages/config-eslint/plugins/vue.js +34 -2
- package/packages/config-hooks/LICENSE +20 -0
- package/packages/config-hooks/README.md +18 -12
- package/packages/config-hooks/index.js +2 -0
- package/packages/config-hooks/lint-staged.js +1 -1
- package/packages/config-hooks/package.json +6 -5
- package/packages/config-htmllint/LICENSE +20 -0
- package/packages/config-markdownlint/LICENSE +20 -0
- package/packages/config-markdownlint/package.json +3 -3
- package/packages/config-npmlint/LICENSE +20 -0
- package/packages/config-npmlint/package.json +2 -2
- package/packages/config-prettier/LICENSE +20 -0
- package/packages/config-prettier/README.md +8 -3
- package/packages/config-prettier/index.js +14 -10
- package/packages/config-prettier/package.json +16 -12
- package/packages/config-prettier/plugins/jsdoc.js +1 -1
- package/packages/config-prettier/plugins/pug.js +1 -1
- package/packages/config-prettier/plugins/sort-json.js +1 -1
- package/packages/config-prettier/plugins/svelte.js +1 -1
- package/packages/config-prettier/plugins/tailwindcss.js +1 -1
- package/packages/config-prettier/plugins/xml.js +1 -1
- package/packages/config-stylelint/LICENSE +20 -0
- package/packages/config-stylelint/README.md +5 -4
- package/packages/config-stylelint/index.js +28 -27
- package/packages/config-stylelint/package.json +23 -19
- package/packages/config-stylelint/plugins/a11y.js +1 -1
- package/packages/config-stylelint/plugins/at-rule-no-children.js +2 -2
- package/packages/config-stylelint/plugins/color-format.js +1 -1
- package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +1 -1
- package/packages/config-stylelint/plugins/high-performance-animation.js +1 -1
- package/packages/config-stylelint/plugins/no-nested-media.js +1 -1
- package/packages/config-stylelint/plugins/no-unresolved-module.js +1 -1
- package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +1 -1
- package/packages/config-stylelint/plugins/optional/gamut.js +1 -1
- package/packages/config-stylelint/plugins/optional/logical-css.js +1 -1
- package/packages/config-stylelint/plugins/optional/no-indistinguishable-colors.js +1 -1
- package/packages/config-stylelint/plugins/order.js +1 -1
- package/packages/config-stylelint/plugins/prettier.js +1 -1
- package/packages/config-stylelint/plugins/scss.js +3 -1
- package/packages/config-stylelint/plugins/selector-no-empty.js +1 -1
- package/packages/config-stylelint/plugins/use-nesting.js +1 -1
- package/packages/config-stylelint/plugins/vue.js +1 -1
- package/prettier.config.js +5 -0
- package/stylelint.config.js +14 -0
- package/.huskyrc.cjs +0 -3
- package/.lintstagedrc.cjs +0 -3
- package/.prettierrc.cjs +0 -3
- package/.stylelintrc.cjs +0 -4
- package/packages/config-hooks/husky.js +0 -6
- package/packages/config-markdownlint/node_modules/markdown-it/LICENSE +0 -22
- package/packages/config-markdownlint/node_modules/markdown-it/README.md +0 -309
- package/packages/config-markdownlint/node_modules/markdown-it/bin/markdown-it.js +0 -117
- package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.js +0 -8441
- package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
- package/packages/config-markdownlint/node_modules/markdown-it/index.js +0 -4
- package/packages/config-markdownlint/node_modules/markdown-it/lib/common/entities.js +0 -6
- package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_blocks.js +0 -70
- package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_re.js +0 -28
- package/packages/config-markdownlint/node_modules/markdown-it/lib/common/utils.js +0 -317
- package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/index.js +0 -7
- package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_destination.js +0 -80
- package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_label.js +0 -48
- package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_title.js +0 -55
- package/packages/config-markdownlint/node_modules/markdown-it/lib/index.js +0 -582
- package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_block.js +0 -131
- package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_core.js +0 -61
- package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_inline.js +0 -192
- package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/commonmark.js +0 -81
- package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/default.js +0 -41
- package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/zero.js +0 -63
- package/packages/config-markdownlint/node_modules/markdown-it/lib/renderer.js +0 -341
- package/packages/config-markdownlint/node_modules/markdown-it/lib/ruler.js +0 -352
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/blockquote.js +0 -226
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/code.js +0 -34
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/fence.js +0 -98
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/heading.js +0 -55
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/hr.js +0 -45
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/html_block.js +0 -74
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/lheading.js +0 -83
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/list.js +0 -362
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/paragraph.js +0 -51
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/reference.js +0 -198
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/state_block.js +0 -231
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/table.js +0 -221
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/block.js +0 -16
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/inline.js +0 -13
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/linkify.js +0 -142
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/normalize.js +0 -21
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/replacements.js +0 -105
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/smartquotes.js +0 -201
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/state_core.js +0 -20
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/text_join.js +0 -45
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/autolink.js +0 -76
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/backticks.js +0 -63
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/balance_pairs.js +0 -130
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/emphasis.js +0 -130
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/entity.js +0 -55
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/escape.js +0 -71
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/fragments_join.js +0 -41
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/html_inline.js +0 -58
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/image.js +0 -152
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/link.js +0 -150
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/linkify.js +0 -62
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/newline.js +0 -46
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/state_inline.js +0 -158
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/strikethrough.js +0 -130
- package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/text.js +0 -89
- package/packages/config-markdownlint/node_modules/markdown-it/lib/token.js +0 -201
- package/packages/config-markdownlint/node_modules/markdown-it/package.json +0 -87
- package/packages/config-markdownlint/node_modules/markdownlint/CHANGELOG.md +0 -428
- package/packages/config-markdownlint/node_modules/markdownlint/CONTRIBUTING.md +0 -92
- package/packages/config-markdownlint/node_modules/markdownlint/LICENSE +0 -21
- package/packages/config-markdownlint/node_modules/markdownlint/README.md +0 -1026
- package/packages/config-markdownlint/node_modules/markdownlint/demo/markdownlint-browser.js +0 -6814
- package/packages/config-markdownlint/node_modules/markdownlint/doc/CustomRules.md +0 -376
- package/packages/config-markdownlint/node_modules/markdownlint/doc/Prettier.md +0 -27
- package/packages/config-markdownlint/node_modules/markdownlint/doc/ReleaseProcess.md +0 -20
- package/packages/config-markdownlint/node_modules/markdownlint/doc/Rules.md +0 -2335
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md001.md +0 -37
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md003.md +0 -59
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md004.md +0 -49
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md005.md +0 -53
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md007.md +0 -52
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md009.md +0 -51
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md010.md +0 -56
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md011.md +0 -30
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md012.md +0 -38
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md013.md +0 -57
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md014.md +0 -54
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md018.md +0 -27
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md019.md +0 -28
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md020.md +0 -29
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md021.md +0 -31
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md022.md +0 -52
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md023.md +0 -33
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md024.md +0 -47
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md025.md +0 -49
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md026.md +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md027.md +0 -24
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md028.md +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md029.md +0 -98
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md030.md +0 -82
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md031.md +0 -50
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md032.md +0 -55
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md033.md +0 -27
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md034.md +0 -50
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md035.md +0 -42
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md036.md +0 -45
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md037.md +0 -37
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md038.md +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md039.md +0 -21
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md040.md +0 -52
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md041.md +0 -49
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md042.md +0 -32
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md043.md +0 -69
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md044.md +0 -35
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md045.md +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md046.md +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md047.md +0 -34
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md048.md +0 -41
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md049.md +0 -32
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md050.md +0 -32
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md051.md +0 -61
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md052.md +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md053.md +0 -38
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md054.md +0 -100
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/LICENSE +0 -21
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/README.md +0 -70
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/helpers.js +0 -1025
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/micromark.cjs +0 -426
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/package.json +0 -26
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/shared.js +0 -10
- package/packages/config-markdownlint/node_modules/markdownlint/lib/cache.js +0 -21
- package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration.d.ts +0 -1152
- package/packages/config-markdownlint/node_modules/markdownlint/lib/constants.js +0 -14
- package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.d.ts +0 -406
- package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.js +0 -1476
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md001.js +0 -22
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md003.js +0 -42
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md004.js +0 -76
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md005.js +0 -73
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md007.js +0 -86
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md009.js +0 -86
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md010.js +0 -60
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md011.js +0 -46
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md012.js +0 -32
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md013.js +0 -96
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md014.js +0 -53
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md018.js +0 -34
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md019.js +0 -39
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md020.js +0 -62
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md021.js +0 -62
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md022.js +0 -108
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md023.js +0 -38
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md024.js +0 -38
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md025.js +0 -32
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md026.js +0 -50
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md027.js +0 -56
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md028.js +0 -30
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md029.js +0 -67
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md030.js +0 -61
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md031.js +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md032.js +0 -78
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md033.js +0 -39
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md034.js +0 -79
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md035.js +0 -24
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md036.js +0 -56
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md037.js +0 -91
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md038.js +0 -97
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md039.js +0 -67
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md040.js +0 -37
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md041.js +0 -42
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md042.js +0 -49
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md043.js +0 -64
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md044.js +0 -107
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md045.js +0 -60
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md046.js +0 -33
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md047.js +0 -28
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md048.js +0 -30
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md049-md050.js +0 -89
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md051.js +0 -172
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md052.js +0 -39
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md053.js +0 -59
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md054.js +0 -125
- package/packages/config-markdownlint/node_modules/markdownlint/lib/rules.js +0 -65
- package/packages/config-markdownlint/node_modules/markdownlint/package.json +0 -109
- package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.jsonc +0 -297
- package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.yaml +0 -266
- package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema.json +0 -1762
- package/packages/config-markdownlint/node_modules/markdownlint/style/all.json +0 -5
- package/packages/config-markdownlint/node_modules/markdownlint/style/cirosantilli.json +0 -22
- package/packages/config-markdownlint/node_modules/markdownlint/style/prettier.json +0 -26
- package/packages/config-markdownlint/node_modules/markdownlint/style/relaxed.json +0 -12
- /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
|
-
};
|