@zowe/cli 8.38.0 → 8.39.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/lib/zosfiles/edit/Edit.utils.d.ts.map +1 -1
- package/lib/zosfiles/edit/Edit.utils.js.map +1 -1
- package/node_modules/@zowe/core-for-zowe-sdk/lib/constants/Core.constants.d.ts +1 -1
- package/node_modules/@zowe/core-for-zowe-sdk/lib/constants/Core.constants.js +1 -1
- package/node_modules/@zowe/core-for-zowe-sdk/package.json +3 -3
- package/node_modules/@zowe/imperative/package.json +2 -2
- package/node_modules/@zowe/imperative/web-help/package-lock.json +61 -61
- package/node_modules/@zowe/provisioning-for-zowe-sdk/package.json +4 -4
- package/node_modules/@zowe/secrets-for-zowe-sdk/package.json +1 -1
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.darwin-arm64.node +0 -0
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.darwin-x64.node +0 -0
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-arm-gnueabihf.node +0 -0
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-arm64-gnu.node +0 -0
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-ia32-gnu.node +0 -0
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-x64-gnu.node +0 -0
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-arm64-msvc.node +0 -0
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-ia32-msvc.node +0 -0
- package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-x64-msvc.node +0 -0
- package/node_modules/@zowe/zos-console-for-zowe-sdk/package.json +4 -4
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/constants/ZosFiles.messages.d.ts.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/constants/ZosFiles.messages.js +27 -0
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/constants/ZosFiles.messages.js.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.d.ts.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.js +57 -2
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.js.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.d.ts.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.js +1 -0
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.js.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.d.ts.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.js +1 -0
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.js.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.d.ts +10 -0
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.d.ts.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.js +43 -17
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.js.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.d.ts +25 -0
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.d.ts.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.js +53 -0
- package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.js.map +1 -1
- package/node_modules/@zowe/zos-files-for-zowe-sdk/package.json +5 -5
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/CancelJobs.d.ts.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/CancelJobs.js +2 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/CancelJobs.js.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DeleteJobs.d.ts.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DeleteJobs.js +2 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DeleteJobs.js.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DownloadJobs.d.ts.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DownloadJobs.js +3 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DownloadJobs.js.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/GetJobs.d.ts.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/GetJobs.js +8 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/GetJobs.js.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsMessages.d.ts.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsMessages.js +24 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsMessages.js.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsUtils.d.ts +39 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsUtils.d.ts.map +1 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsUtils.js +72 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsUtils.js.map +1 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/ModifyJobs.d.ts.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/ModifyJobs.js +2 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/ModifyJobs.js.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/SearchJobs.d.ts.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/SearchJobs.js +3 -0
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/SearchJobs.js.map +1 -1
- package/node_modules/@zowe/zos-jobs-for-zowe-sdk/package.json +5 -5
- package/node_modules/@zowe/zos-logs-for-zowe-sdk/package.json +4 -4
- package/node_modules/@zowe/zos-tso-for-zowe-sdk/package.json +5 -5
- package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/Shell.d.ts.map +1 -1
- package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/Shell.js +1 -1
- package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/Shell.js.map +1 -1
- package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/SshSession.d.ts.map +1 -1
- package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/SshSession.js.map +1 -1
- package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/doc/ISshSession.d.ts +14 -0
- package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/doc/ISshSession.d.ts.map +1 -1
- package/node_modules/@zowe/zos-uss-for-zowe-sdk/package.json +3 -3
- package/node_modules/@zowe/zos-workflows-for-zowe-sdk/lib/Create.d.ts.map +1 -1
- package/node_modules/@zowe/zos-workflows-for-zowe-sdk/lib/Create.js +3 -2
- package/node_modules/@zowe/zos-workflows-for-zowe-sdk/lib/Create.js.map +1 -1
- package/node_modules/@zowe/zos-workflows-for-zowe-sdk/package.json +5 -5
- package/node_modules/@zowe/zosmf-for-zowe-sdk/package.json +4 -4
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts +4 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/brace-expansion/dist/commonjs/index.js +69 -25
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.d.ts +4 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.js +68 -24
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
- package/node_modules/brace-expansion/package.json +2 -1
- package/node_modules/markdown-it/dist/index.cjs.js +3696 -5376
- package/node_modules/markdown-it/dist/index.cjs.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.js +1446 -4481
- package/node_modules/markdown-it/dist/markdown-it.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.min.js +3 -2
- package/node_modules/markdown-it/dist/markdown-it.min.js.map +1 -0
- package/node_modules/markdown-it/lib/common/html_re.mjs +9 -9
- package/node_modules/markdown-it/lib/common/utils.mjs +2 -11
- package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +1 -1
- package/node_modules/markdown-it/lib/parser_block.mjs +9 -9
- package/node_modules/markdown-it/lib/parser_core.mjs +7 -7
- package/node_modules/markdown-it/lib/parser_inline.mjs +16 -16
- package/node_modules/markdown-it/lib/renderer.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +6 -6
- package/node_modules/markdown-it/lib/rules_block/code.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_block/fence.mjs +4 -4
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +7 -7
- package/node_modules/markdown-it/lib/rules_block/hr.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +6 -6
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +8 -8
- package/node_modules/markdown-it/lib/rules_block/list.mjs +6 -6
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +5 -5
- package/node_modules/markdown-it/lib/rules_block/reference.mjs +1 -1
- package/node_modules/markdown-it/lib/rules_block/state_block.mjs +6 -6
- package/node_modules/markdown-it/lib/rules_block/table.mjs +4 -4
- package/node_modules/markdown-it/lib/rules_core/block.mjs +3 -3
- package/node_modules/markdown-it/lib/rules_core/linkify.mjs +46 -20
- package/node_modules/markdown-it/lib/rules_core/normalize.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +48 -27
- package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +17 -17
- package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +8 -8
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +7 -7
- package/node_modules/markdown-it/lib/rules_inline/escape.mjs +15 -1
- package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +1 -1
- package/node_modules/markdown-it/lib/rules_inline/link.mjs +1 -1
- package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +27 -9
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +10 -10
- package/node_modules/markdown-it/lib/token.mjs +12 -12
- package/node_modules/markdown-it/package.json +27 -34
- package/package.json +14 -14
|
@@ -6,6 +6,19 @@ import { isWhiteSpace, isPunctCharCode, isMdAsciiPunct } from '../common/utils.m
|
|
|
6
6
|
const QUOTE_TEST_RE = /['"]/
|
|
7
7
|
const QUOTE_RE = /['"]/g
|
|
8
8
|
const APOSTROPHE = '\u2019' /* ’ */
|
|
9
|
+
// Caps memory on malicious input
|
|
10
|
+
const MAX_OPENERS = 1000
|
|
11
|
+
|
|
12
|
+
function truncateStack (stack, heads, length) {
|
|
13
|
+
while (stack.length > length) {
|
|
14
|
+
const item = stack.pop()
|
|
15
|
+
if (item.isSingleQuote) {
|
|
16
|
+
heads.single = item.prevSameQuoteIdx
|
|
17
|
+
} else {
|
|
18
|
+
heads.double = item.prevSameQuoteIdx
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
9
22
|
|
|
10
23
|
function addReplacement (replacements, tokenIdx, pos, ch) {
|
|
11
24
|
if (!replacements[tokenIdx]) {
|
|
@@ -35,6 +48,8 @@ function process_inlines (tokens, state) {
|
|
|
35
48
|
let j
|
|
36
49
|
|
|
37
50
|
const stack = []
|
|
51
|
+
// stack indexes of topmost openers of each type (-1 if none)
|
|
52
|
+
const heads = { single: -1, double: -1 }
|
|
38
53
|
// token index -> list of replacements in the original token content
|
|
39
54
|
const replacements = {}
|
|
40
55
|
|
|
@@ -46,7 +61,7 @@ function process_inlines (tokens, state) {
|
|
|
46
61
|
for (j = stack.length - 1; j >= 0; j--) {
|
|
47
62
|
if (stack[j].level <= thisLevel) { break }
|
|
48
63
|
}
|
|
49
|
-
stack
|
|
64
|
+
truncateStack(stack, heads, j + 1)
|
|
50
65
|
|
|
51
66
|
if (token.type !== 'text') { continue }
|
|
52
67
|
|
|
@@ -150,39 +165,45 @@ function process_inlines (tokens, state) {
|
|
|
150
165
|
}
|
|
151
166
|
|
|
152
167
|
if (canClose) {
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
closeQuote = state.md.options.quotes[1]
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
addReplacement(replacements, i, t.index, closeQuote)
|
|
171
|
-
addReplacement(replacements, item.token, item.pos, openQuote)
|
|
172
|
-
|
|
173
|
-
stack.length = j
|
|
174
|
-
continue OUTER
|
|
168
|
+
// Stack levels never decrease, so an opener of this type below
|
|
169
|
+
// the current level means there is no match
|
|
170
|
+
j = isSingle ? heads.single : heads.double
|
|
171
|
+
if (j >= 0 && stack[j].level === thisLevel) {
|
|
172
|
+
const item = stack[j]
|
|
173
|
+
|
|
174
|
+
let openQuote
|
|
175
|
+
let closeQuote
|
|
176
|
+
if (isSingle) {
|
|
177
|
+
openQuote = state.md.options.quotes[2]
|
|
178
|
+
closeQuote = state.md.options.quotes[3]
|
|
179
|
+
} else {
|
|
180
|
+
openQuote = state.md.options.quotes[0]
|
|
181
|
+
closeQuote = state.md.options.quotes[1]
|
|
175
182
|
}
|
|
183
|
+
|
|
184
|
+
addReplacement(replacements, i, t.index, closeQuote)
|
|
185
|
+
addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote)
|
|
186
|
+
|
|
187
|
+
truncateStack(stack, heads, j)
|
|
188
|
+
continue OUTER
|
|
176
189
|
}
|
|
177
190
|
}
|
|
178
191
|
|
|
179
192
|
if (canOpen) {
|
|
193
|
+
if (stack.length >= MAX_OPENERS) { return }
|
|
180
194
|
stack.push({
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
level: thisLevel
|
|
195
|
+
tokenIdx: i,
|
|
196
|
+
contentPos: t.index,
|
|
197
|
+
isSingleQuote: isSingle,
|
|
198
|
+
level: thisLevel,
|
|
199
|
+
// stack index of the previous opener of the same quote type, -1 if none
|
|
200
|
+
prevSameQuoteIdx: isSingle ? heads.single : heads.double
|
|
185
201
|
})
|
|
202
|
+
if (isSingle) {
|
|
203
|
+
heads.single = stack.length - 1
|
|
204
|
+
} else {
|
|
205
|
+
heads.double = stack.length - 1
|
|
206
|
+
}
|
|
186
207
|
} else if (canClose && isSingle) {
|
|
187
208
|
addReplacement(replacements, i, t.index, APOSTROPHE)
|
|
188
209
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Process autolinks '<protocol:...>'
|
|
2
2
|
|
|
3
3
|
/* eslint max-len:0 */
|
|
4
|
-
const EMAIL_RE
|
|
4
|
+
const EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/
|
|
5
5
|
/* eslint-disable-next-line no-control-regex */
|
|
6
6
|
const AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/
|
|
7
7
|
|
|
@@ -29,17 +29,17 @@ export default function autolink (state, silent) {
|
|
|
29
29
|
if (!state.md.validateLink(fullUrl)) { return false }
|
|
30
30
|
|
|
31
31
|
if (!silent) {
|
|
32
|
-
const token_o
|
|
33
|
-
token_o.attrs
|
|
34
|
-
token_o.markup
|
|
35
|
-
token_o.info
|
|
32
|
+
const token_o = state.push('link_open', 'a', 1)
|
|
33
|
+
token_o.attrs = [['href', fullUrl]]
|
|
34
|
+
token_o.markup = 'autolink'
|
|
35
|
+
token_o.info = 'auto'
|
|
36
36
|
|
|
37
|
-
const token_t
|
|
37
|
+
const token_t = state.push('text', '', 0)
|
|
38
38
|
token_t.content = state.md.normalizeLinkText(url)
|
|
39
39
|
|
|
40
|
-
const token_c
|
|
41
|
-
token_c.markup
|
|
42
|
-
token_c.info
|
|
40
|
+
const token_c = state.push('link_close', 'a', -1)
|
|
41
|
+
token_c.markup = 'autolink'
|
|
42
|
+
token_c.info = 'auto'
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
state.pos += url.length + 2
|
|
@@ -51,17 +51,17 @@ export default function autolink (state, silent) {
|
|
|
51
51
|
if (!state.md.validateLink(fullUrl)) { return false }
|
|
52
52
|
|
|
53
53
|
if (!silent) {
|
|
54
|
-
const token_o
|
|
55
|
-
token_o.attrs
|
|
56
|
-
token_o.markup
|
|
57
|
-
token_o.info
|
|
54
|
+
const token_o = state.push('link_open', 'a', 1)
|
|
55
|
+
token_o.attrs = [['href', fullUrl]]
|
|
56
|
+
token_o.markup = 'autolink'
|
|
57
|
+
token_o.info = 'auto'
|
|
58
58
|
|
|
59
|
-
const token_t
|
|
59
|
+
const token_t = state.push('text', '', 0)
|
|
60
60
|
token_t.content = state.md.normalizeLinkText(url)
|
|
61
61
|
|
|
62
|
-
const token_c
|
|
63
|
-
token_c.markup
|
|
64
|
-
token_c.info
|
|
62
|
+
const token_c = state.push('link_close', 'a', -1)
|
|
63
|
+
token_c.markup = 'autolink'
|
|
64
|
+
token_c.info = 'auto'
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
state.pos += url.length + 2
|
|
@@ -85,8 +85,8 @@ function processDelimiters (delimiters) {
|
|
|
85
85
|
jumps[closerIdx] = closerIdx - openerIdx + lastJump
|
|
86
86
|
jumps[openerIdx] = lastJump
|
|
87
87
|
|
|
88
|
-
closer.open
|
|
89
|
-
opener.end
|
|
88
|
+
closer.open = false
|
|
89
|
+
opener.end = closerIdx
|
|
90
90
|
opener.close = false
|
|
91
91
|
newMinOpenerIdx = -1
|
|
92
92
|
// treat next token as start of run,
|
|
@@ -80,18 +80,18 @@ function postProcess (state, delimiters) {
|
|
|
80
80
|
|
|
81
81
|
const ch = String.fromCharCode(startDelim.marker)
|
|
82
82
|
|
|
83
|
-
const token_o
|
|
84
|
-
token_o.type
|
|
85
|
-
token_o.tag
|
|
83
|
+
const token_o = state.tokens[startDelim.token]
|
|
84
|
+
token_o.type = isStrong ? 'strong_open' : 'em_open'
|
|
85
|
+
token_o.tag = isStrong ? 'strong' : 'em'
|
|
86
86
|
token_o.nesting = 1
|
|
87
|
-
token_o.markup
|
|
87
|
+
token_o.markup = isStrong ? ch + ch : ch
|
|
88
88
|
token_o.content = ''
|
|
89
89
|
|
|
90
|
-
const token_c
|
|
91
|
-
token_c.type
|
|
92
|
-
token_c.tag
|
|
90
|
+
const token_c = state.tokens[endDelim.token]
|
|
91
|
+
token_c.type = isStrong ? 'strong_close' : 'em_close'
|
|
92
|
+
token_c.tag = isStrong ? 'strong' : 'em'
|
|
93
93
|
token_c.nesting = -1
|
|
94
|
-
token_c.markup
|
|
94
|
+
token_c.markup = isStrong ? ch + ch : ch
|
|
95
95
|
token_c.content = ''
|
|
96
96
|
|
|
97
97
|
if (isStrong) {
|
|
@@ -4,7 +4,7 @@ import { decodeHTMLStrict } from 'entities'
|
|
|
4
4
|
import { isValidEntityCode, fromCodePoint } from '../common/utils.mjs'
|
|
5
5
|
|
|
6
6
|
const DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i
|
|
7
|
-
const NAMED_RE
|
|
7
|
+
const NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i
|
|
8
8
|
|
|
9
9
|
export default function entity (state, silent) {
|
|
10
10
|
const pos = state.pos
|
|
@@ -22,10 +22,10 @@ export default function entity (state, silent) {
|
|
|
22
22
|
if (!silent) {
|
|
23
23
|
const code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10)
|
|
24
24
|
|
|
25
|
-
const token
|
|
25
|
+
const token = state.push('text_special', '', 0)
|
|
26
26
|
token.content = isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD)
|
|
27
|
-
token.markup
|
|
28
|
-
token.info
|
|
27
|
+
token.markup = match[0]
|
|
28
|
+
token.info = 'entity'
|
|
29
29
|
}
|
|
30
30
|
state.pos += match[0].length
|
|
31
31
|
return true
|
|
@@ -36,10 +36,10 @@ export default function entity (state, silent) {
|
|
|
36
36
|
const decoded = decodeHTMLStrict(match[0])
|
|
37
37
|
if (decoded !== match[0]) {
|
|
38
38
|
if (!silent) {
|
|
39
|
-
const token
|
|
39
|
+
const token = state.push('text_special', '', 0)
|
|
40
40
|
token.content = decoded
|
|
41
|
-
token.markup
|
|
42
|
-
token.info
|
|
41
|
+
token.markup = match[0]
|
|
42
|
+
token.info = 'entity'
|
|
43
43
|
}
|
|
44
44
|
state.pos += match[0].length
|
|
45
45
|
return true
|
|
@@ -38,6 +38,20 @@ export default function escape (state, silent) {
|
|
|
38
38
|
return true
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// '\' before a space is a literal backslash. Don't consume the space, so a
|
|
42
|
+
// trailing two-space hard line break is still detected by the newline rule.
|
|
43
|
+
if (ch1 === 0x20) {
|
|
44
|
+
if (!silent) {
|
|
45
|
+
const token = state.push('text_special', '', 0)
|
|
46
|
+
token.content = '\\'
|
|
47
|
+
token.markup = '\\'
|
|
48
|
+
token.info = 'escape'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
state.pos = pos
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
54
|
+
|
|
41
55
|
let escapedStr = state.src[pos]
|
|
42
56
|
|
|
43
57
|
if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {
|
|
@@ -61,7 +75,7 @@ export default function escape (state, silent) {
|
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
token.markup = origStr
|
|
64
|
-
token.info
|
|
78
|
+
token.info = 'escape'
|
|
65
79
|
}
|
|
66
80
|
|
|
67
81
|
state.pos = pos + 1
|
|
@@ -42,7 +42,7 @@ export default function html_inline (state, silent) {
|
|
|
42
42
|
const token = state.push('html_inline', '', 0)
|
|
43
43
|
token.content = match[0]
|
|
44
44
|
|
|
45
|
-
if (isLinkOpen(token.content))
|
|
45
|
+
if (isLinkOpen(token.content)) state.linkLevel++
|
|
46
46
|
if (isLinkClose(token.content)) state.linkLevel--
|
|
47
47
|
}
|
|
48
48
|
state.pos += match[0].length
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Early process links like https://example.org/ to have priority
|
|
2
|
+
// over emphasis, etc.
|
|
2
3
|
|
|
3
4
|
// RFC3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
|
4
|
-
|
|
5
|
+
function isAsciiAlpha (code) {
|
|
6
|
+
return (code >= 0x41 && code <= 0x5A) || (code >= 0x61 && code <= 0x7A)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function isSchemeChar (code) {
|
|
10
|
+
return (code >= 0x41 && code <= 0x5A) ||
|
|
11
|
+
(code >= 0x61 && code <= 0x7A) ||
|
|
12
|
+
(code >= 0x30 && code <= 0x39) ||
|
|
13
|
+
code === 0x2B || code === 0x2D || code === 0x2E
|
|
14
|
+
}
|
|
5
15
|
|
|
6
16
|
export default function linkify (state, silent) {
|
|
7
17
|
if (!state.md.options.linkify) return false
|
|
@@ -15,19 +25,27 @@ export default function linkify (state, silent) {
|
|
|
15
25
|
if (state.src.charCodeAt(pos + 1) !== 0x2F/* / */) return false
|
|
16
26
|
if (state.src.charCodeAt(pos + 2) !== 0x2F/* / */) return false
|
|
17
27
|
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
// Search backwards for the scheme, but no more than 10 characters, the length
|
|
29
|
+
// of the pending string, or the length of the source prefix.
|
|
30
|
+
// Use state.src instead of state.pending because it is faster to access.
|
|
31
|
+
const protoMin = pos - Math.min(10, state.pending.length, pos)
|
|
32
|
+
let protoStart = pos
|
|
33
|
+
while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) {
|
|
34
|
+
protoStart--
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false
|
|
20
38
|
|
|
21
|
-
const
|
|
39
|
+
const protoLength = pos - protoStart
|
|
22
40
|
|
|
23
|
-
const link = state.md.linkify.matchAtStart(state.src.slice(
|
|
41
|
+
const link = state.md.linkify.matchAtStart(state.src.slice(protoStart))
|
|
24
42
|
if (!link) return false
|
|
25
43
|
|
|
26
44
|
let url = link.url
|
|
27
45
|
|
|
28
46
|
// invalid link, but still detected by linkify somehow;
|
|
29
47
|
// need to check to prevent infinite loop below
|
|
30
|
-
if (url.length <=
|
|
48
|
+
if (url.length <= protoLength) return false
|
|
31
49
|
|
|
32
50
|
// disallow '*' at the end of the link (conflicts with emphasis)
|
|
33
51
|
// do manual backsearch to avoid perf issues with regex /\*+$/ on "****...****a".
|
|
@@ -43,7 +61,7 @@ export default function linkify (state, silent) {
|
|
|
43
61
|
if (!state.md.validateLink(fullUrl)) return false
|
|
44
62
|
|
|
45
63
|
if (!silent) {
|
|
46
|
-
state.pending = state.pending.slice(0, -
|
|
64
|
+
state.pending = state.pending.slice(0, -protoLength)
|
|
47
65
|
|
|
48
66
|
const token_o = state.push('link_open', 'a', 1)
|
|
49
67
|
token_o.attrs = [['href', fullUrl]]
|
|
@@ -58,6 +76,6 @@ export default function linkify (state, silent) {
|
|
|
58
76
|
token_c.info = 'auto'
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
state.pos += url.length -
|
|
79
|
+
state.pos += url.length - protoLength
|
|
62
80
|
return true
|
|
63
81
|
}
|
|
@@ -142,8 +142,8 @@ StateInline.prototype.scanDelims = function (start, canSplitWord) {
|
|
|
142
142
|
const right_flanking =
|
|
143
143
|
!isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar)
|
|
144
144
|
|
|
145
|
-
const can_open
|
|
146
|
-
const can_close = right_flanking && (canSplitWord || !left_flanking
|
|
145
|
+
const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar)
|
|
146
|
+
const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar)
|
|
147
147
|
|
|
148
148
|
return { can_open, can_close, length: count }
|
|
149
149
|
}
|
|
@@ -20,13 +20,13 @@ function strikethrough_tokenize (state, silent) {
|
|
|
20
20
|
let token
|
|
21
21
|
|
|
22
22
|
if (len % 2) {
|
|
23
|
-
token
|
|
23
|
+
token = state.push('text', '', 0)
|
|
24
24
|
token.content = ch
|
|
25
25
|
len--
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
for (let i = 0; i < len; i += 2) {
|
|
29
|
-
token
|
|
29
|
+
token = state.push('text', '', 0)
|
|
30
30
|
token.content = ch + ch
|
|
31
31
|
|
|
32
32
|
state.delimiters.push({
|
|
@@ -62,18 +62,18 @@ function postProcess (state, delimiters) {
|
|
|
62
62
|
|
|
63
63
|
const endDelim = delimiters[startDelim.end]
|
|
64
64
|
|
|
65
|
-
token
|
|
66
|
-
token.type
|
|
67
|
-
token.tag
|
|
65
|
+
token = state.tokens[startDelim.token]
|
|
66
|
+
token.type = 's_open'
|
|
67
|
+
token.tag = 's'
|
|
68
68
|
token.nesting = 1
|
|
69
|
-
token.markup
|
|
69
|
+
token.markup = '~~'
|
|
70
70
|
token.content = ''
|
|
71
71
|
|
|
72
|
-
token
|
|
73
|
-
token.type
|
|
74
|
-
token.tag
|
|
72
|
+
token = state.tokens[endDelim.token]
|
|
73
|
+
token.type = 's_close'
|
|
74
|
+
token.tag = 's'
|
|
75
75
|
token.nesting = -1
|
|
76
|
-
token.markup
|
|
76
|
+
token.markup = '~~'
|
|
77
77
|
token.content = ''
|
|
78
78
|
|
|
79
79
|
if (state.tokens[endDelim.token - 1].type === 'text' &&
|
|
@@ -15,28 +15,28 @@ function Token (type, tag, nesting) {
|
|
|
15
15
|
*
|
|
16
16
|
* Type of the token (string, e.g. "paragraph_open")
|
|
17
17
|
**/
|
|
18
|
-
this.type
|
|
18
|
+
this.type = type
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Token#tag -> String
|
|
22
22
|
*
|
|
23
23
|
* html tag name, e.g. "p"
|
|
24
24
|
**/
|
|
25
|
-
this.tag
|
|
25
|
+
this.tag = tag
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Token#attrs -> Array
|
|
29
29
|
*
|
|
30
30
|
* Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
|
|
31
31
|
**/
|
|
32
|
-
this.attrs
|
|
32
|
+
this.attrs = null
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Token#map -> Array
|
|
36
36
|
*
|
|
37
37
|
* Source map info. Format: `[ line_begin, line_end ]`
|
|
38
38
|
**/
|
|
39
|
-
this.map
|
|
39
|
+
this.map = null
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Token#nesting -> Number
|
|
@@ -47,14 +47,14 @@ function Token (type, tag, nesting) {
|
|
|
47
47
|
* - `0` means the tag is self-closing
|
|
48
48
|
* - `-1` means the tag is closing
|
|
49
49
|
**/
|
|
50
|
-
this.nesting
|
|
50
|
+
this.nesting = nesting
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Token#level -> Number
|
|
54
54
|
*
|
|
55
55
|
* nesting level, the same as `state.level`
|
|
56
56
|
**/
|
|
57
|
-
this.level
|
|
57
|
+
this.level = 0
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Token#children -> Array
|
|
@@ -69,14 +69,14 @@ function Token (type, tag, nesting) {
|
|
|
69
69
|
* In a case of self-closing tag (code, html, fence, etc.),
|
|
70
70
|
* it has contents of this tag.
|
|
71
71
|
**/
|
|
72
|
-
this.content
|
|
72
|
+
this.content = ''
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Token#markup -> String
|
|
76
76
|
*
|
|
77
77
|
* '*' or '_' for emphasis, fence string for fence, etc.
|
|
78
78
|
**/
|
|
79
|
-
this.markup
|
|
79
|
+
this.markup = ''
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Token#info -> String
|
|
@@ -87,14 +87,14 @@ function Token (type, tag, nesting) {
|
|
|
87
87
|
* - The value "auto" for autolink "link_open" and "link_close" tokens
|
|
88
88
|
* - The string value of the item marker for ordered-list "list_item_open" tokens
|
|
89
89
|
**/
|
|
90
|
-
this.info
|
|
90
|
+
this.info = ''
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* Token#meta -> Object
|
|
94
94
|
*
|
|
95
95
|
* A place for plugins to store an arbitrary data
|
|
96
96
|
**/
|
|
97
|
-
this.meta
|
|
97
|
+
this.meta = null
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* Token#block -> Boolean
|
|
@@ -102,7 +102,7 @@ function Token (type, tag, nesting) {
|
|
|
102
102
|
* True for block-level tokens, false for inline tokens.
|
|
103
103
|
* Used in renderer to calculate line breaks
|
|
104
104
|
**/
|
|
105
|
-
this.block
|
|
105
|
+
this.block = false
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Token#hidden -> Boolean
|
|
@@ -110,7 +110,7 @@ function Token (type, tag, nesting) {
|
|
|
110
110
|
* If it's true, ignore this element when rendering. Used for tight lists
|
|
111
111
|
* to hide paragraphs.
|
|
112
112
|
**/
|
|
113
|
-
this.hidden
|
|
113
|
+
this.hidden = false
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-it",
|
|
3
|
-
"version": "14.2
|
|
3
|
+
"version": "14.3.2",
|
|
4
4
|
"description": "Markdown-it - modern pluggable markdown parser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -38,49 +38,47 @@
|
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"lint": "eslint .",
|
|
41
|
-
"test": "npm run lint &&
|
|
41
|
+
"test": "npm run lint && npm run test:cmspec && npm run test:markdown-it && npm run test:build",
|
|
42
|
+
"test:cmspec": "node --test --test-reporter=dot test/cmspec/**/*.test.mjs",
|
|
43
|
+
"test:markdown-it": "node --test test/markdown-it/**/*.test.mjs",
|
|
44
|
+
"test:build": "npm run build && node --test test/build/**/*.test.mjs",
|
|
45
|
+
"pathological:track-ref": "node support/track-ref-pathological.mjs",
|
|
46
|
+
"pathological:update-hash": "node support/track-ref-pathological.mjs --update",
|
|
47
|
+
"coverage": "npm run build && c8 --include 'lib/**' -r text -r html -r lcov node --test --test-reporter=dot",
|
|
42
48
|
"doc": "node support/build_doc.mjs",
|
|
43
49
|
"gh-doc": "npm run doc && gh-pages -d apidoc -f",
|
|
44
50
|
"demo": "npm run lint && node support/build_demo.mjs",
|
|
45
51
|
"gh-demo": "npm run demo && gh-pages -d demo -f -b master -r git@github.com:markdown-it/markdown-it.github.io.git",
|
|
46
|
-
"build": "
|
|
47
|
-
"benchmark-deps": "npm install --prefix benchmark/extra/
|
|
52
|
+
"build": "node support/build-dist.mjs",
|
|
53
|
+
"benchmark-deps": "npm install --prefix benchmark/extra/",
|
|
48
54
|
"specsplit": "support/specsplit.mjs good -o test/fixtures/commonmark/good.txt && support/specsplit.mjs bad -o test/fixtures/commonmark/bad.txt && support/specsplit.mjs",
|
|
49
55
|
"todo": "grep 'TODO' -n -r ./lib 2>/dev/null",
|
|
50
|
-
"
|
|
56
|
+
"prepack": "npm test && npm run build"
|
|
51
57
|
},
|
|
52
58
|
"files": [
|
|
53
59
|
"index.mjs",
|
|
54
60
|
"lib/",
|
|
55
61
|
"dist/"
|
|
56
62
|
],
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"tag": "v14-legacy"
|
|
65
|
+
},
|
|
57
66
|
"dependencies": {
|
|
58
67
|
"argparse": "^2.0.1",
|
|
59
|
-
"entities": "^4.
|
|
60
|
-
"linkify-it": "^5.0.
|
|
68
|
+
"entities": "^4.5.0",
|
|
69
|
+
"linkify-it": "^5.0.2",
|
|
61
70
|
"mdurl": "^2.0.0",
|
|
62
71
|
"punycode.js": "^2.3.1",
|
|
63
72
|
"uc.micro": "^2.1.0"
|
|
64
73
|
},
|
|
65
74
|
"devDependencies": {
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"ansi": "^0.3.0",
|
|
71
|
-
"benchmark": "~2.1.0",
|
|
72
|
-
"c8": "^8.0.1",
|
|
73
|
-
"chai": "^4.2.0",
|
|
74
|
-
"cross-env": "^7.0.3",
|
|
75
|
-
"eslint": "^8.4.1",
|
|
76
|
-
"eslint-config-standard": "^17.1.0",
|
|
77
|
-
"express": "^4.14.0",
|
|
78
|
-
"gh-pages": "^6.1.0",
|
|
79
|
-
"highlight.js": "^11.9.0",
|
|
80
|
-
"jest-worker": "^29.7.0",
|
|
75
|
+
"c8": "^11.0.0",
|
|
76
|
+
"eslint": "^9.39.4",
|
|
77
|
+
"gh-pages": "^6.3.0",
|
|
78
|
+
"highlight.js": "^11.11.1",
|
|
81
79
|
"markdown-it-abbr": "^2.0.0",
|
|
82
80
|
"markdown-it-container": "^4.0.0",
|
|
83
|
-
"markdown-it-deflist": "^3.0.
|
|
81
|
+
"markdown-it-deflist": "^3.0.1",
|
|
84
82
|
"markdown-it-emoji": "^3.0.0",
|
|
85
83
|
"markdown-it-footnote": "^4.0.0",
|
|
86
84
|
"markdown-it-for-inline": "^2.0.1",
|
|
@@ -88,16 +86,11 @@
|
|
|
88
86
|
"markdown-it-mark": "^4.0.0",
|
|
89
87
|
"markdown-it-sub": "^2.0.0",
|
|
90
88
|
"markdown-it-sup": "^2.0.0",
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"supertest": "^6.0.1"
|
|
98
|
-
},
|
|
99
|
-
"mocha": {
|
|
100
|
-
"inline-diffs": true,
|
|
101
|
-
"timeout": 60000
|
|
89
|
+
"ndoc": "^6.0.1",
|
|
90
|
+
"neostandard": "^0.13.0",
|
|
91
|
+
"terser": "^5.48.0",
|
|
92
|
+
"tinybench": "^6.0.2",
|
|
93
|
+
"vite": "^8.1.2",
|
|
94
|
+
"vite-plugin-singlefile": "^2.3.3"
|
|
102
95
|
}
|
|
103
96
|
}
|