@vuepress/markdown 2.0.0-beta.48 → 2.0.0-beta.50-pre
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/package.json +39 -8
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -20
- package/lib/markdown.d.ts +0 -5
- package/lib/markdown.js +0 -88
- package/lib/plugins/anchorPlugin.d.ts +0 -3
- package/lib/plugins/anchorPlugin.js +0 -5
- package/lib/plugins/assetsPlugin/assetsPlugin.d.ts +0 -11
- package/lib/plugins/assetsPlugin/assetsPlugin.js +0 -41
- package/lib/plugins/assetsPlugin/index.d.ts +0 -2
- package/lib/plugins/assetsPlugin/index.js +0 -18
- package/lib/plugins/assetsPlugin/resolveLink.d.ts +0 -2
- package/lib/plugins/assetsPlugin/resolveLink.js +0 -16
- package/lib/plugins/codePlugin/codePlugin.d.ts +0 -40
- package/lib/plugins/codePlugin/codePlugin.js +0 -78
- package/lib/plugins/codePlugin/index.d.ts +0 -6
- package/lib/plugins/codePlugin/index.js +0 -22
- package/lib/plugins/codePlugin/languages.d.ts +0 -38
- package/lib/plugins/codePlugin/languages.js +0 -68
- package/lib/plugins/codePlugin/resolveHighlightLines.d.ts +0 -9
- package/lib/plugins/codePlugin/resolveHighlightLines.js +0 -28
- package/lib/plugins/codePlugin/resolveLanguage.d.ts +0 -5
- package/lib/plugins/codePlugin/resolveLanguage.js +0 -40
- package/lib/plugins/codePlugin/resolveLineNumbers.d.ts +0 -4
- package/lib/plugins/codePlugin/resolveLineNumbers.js +0 -16
- package/lib/plugins/codePlugin/resolveVPre.d.ts +0 -4
- package/lib/plugins/codePlugin/resolveVPre.js +0 -16
- package/lib/plugins/customComponentPlugin/customComponentPlugin.d.ts +0 -6
- package/lib/plugins/customComponentPlugin/customComponentPlugin.js +0 -18
- package/lib/plugins/customComponentPlugin/htmlBlockRule.d.ts +0 -2
- package/lib/plugins/customComponentPlugin/htmlBlockRule.js +0 -90
- package/lib/plugins/customComponentPlugin/htmlInlineRule.d.ts +0 -2
- package/lib/plugins/customComponentPlugin/htmlInlineRule.js +0 -40
- package/lib/plugins/customComponentPlugin/htmlRe.d.ts +0 -2
- package/lib/plugins/customComponentPlugin/htmlRe.js +0 -33
- package/lib/plugins/customComponentPlugin/index.d.ts +0 -6
- package/lib/plugins/customComponentPlugin/index.js +0 -22
- package/lib/plugins/customComponentPlugin/inlineTags.d.ts +0 -18
- package/lib/plugins/customComponentPlugin/inlineTags.js +0 -78
- package/lib/plugins/customComponentPlugin/vueReservedTags.d.ts +0 -6
- package/lib/plugins/customComponentPlugin/vueReservedTags.js +0 -17
- package/lib/plugins/emojiPlugin.d.ts +0 -25
- package/lib/plugins/emojiPlugin.js +0 -5
- package/lib/plugins/extractHeadersPlugin.d.ts +0 -28
- package/lib/plugins/extractHeadersPlugin.js +0 -32
- package/lib/plugins/extractTitlePlugin.d.ts +0 -5
- package/lib/plugins/extractTitlePlugin.js +0 -33
- package/lib/plugins/hoistTagsPlugin.d.ts +0 -12
- package/lib/plugins/hoistTagsPlugin.js +0 -27
- package/lib/plugins/importCodePlugin/createImportCodeBlockRule.d.ts +0 -3
- package/lib/plugins/importCodePlugin/createImportCodeBlockRule.js +0 -52
- package/lib/plugins/importCodePlugin/importCodePlugin.d.ts +0 -8
- package/lib/plugins/importCodePlugin/importCodePlugin.js +0 -26
- package/lib/plugins/importCodePlugin/index.d.ts +0 -4
- package/lib/plugins/importCodePlugin/index.js +0 -20
- package/lib/plugins/importCodePlugin/resolveImportCode.d.ts +0 -6
- package/lib/plugins/importCodePlugin/resolveImportCode.js +0 -37
- package/lib/plugins/importCodePlugin/types.d.ts +0 -5
- package/lib/plugins/importCodePlugin/types.js +0 -2
- package/lib/plugins/index.d.ts +0 -11
- package/lib/plugins/index.js +0 -27
- package/lib/plugins/linksPlugin/index.d.ts +0 -2
- package/lib/plugins/linksPlugin/index.js +0 -18
- package/lib/plugins/linksPlugin/linksPlugin.d.ts +0 -28
- package/lib/plugins/linksPlugin/linksPlugin.js +0 -98
- package/lib/plugins/linksPlugin/resolvePaths.d.ts +0 -7
- package/lib/plugins/linksPlugin/resolvePaths.js +0 -51
- package/lib/plugins/tocPlugin/createRenderHeaders.d.ts +0 -5
- package/lib/plugins/tocPlugin/createRenderHeaders.js +0 -28
- package/lib/plugins/tocPlugin/createTocBlockRule.d.ts +0 -11
- package/lib/plugins/tocPlugin/createTocBlockRule.js +0 -50
- package/lib/plugins/tocPlugin/index.d.ts +0 -3
- package/lib/plugins/tocPlugin/index.js +0 -19
- package/lib/plugins/tocPlugin/tocPlugin.d.ts +0 -66
- package/lib/plugins/tocPlugin/tocPlugin.js +0 -56
- package/lib/types.d.ts +0 -81
- package/lib/types.js +0 -2
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/index.js +0 -19
- package/lib/utils/resolveHeadersFromTokens.d.ts +0 -12
- package/lib/utils/resolveHeadersFromTokens.js +0 -63
- package/lib/utils/resolveTitleFromToken.d.ts +0 -10
- package/lib/utils/resolveTitleFromToken.js +0 -37
- package/lib/utils/vuepressSlugify.d.ts +0 -5
- package/lib/utils/vuepressSlugify.js +0 -27
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveLineNumbers = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Resolve the `:line-numbers` / `:no-line-numbers` mark from token info
|
|
6
|
-
*/
|
|
7
|
-
const resolveLineNumbers = (info) => {
|
|
8
|
-
if (/:line-numbers\b/.test(info)) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
if (/:no-line-numbers\b/.test(info)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
};
|
|
16
|
-
exports.resolveLineNumbers = resolveLineNumbers;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveVPre = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Resolve the `:v-pre` / `:no-v-pre` mark from token info
|
|
6
|
-
*/
|
|
7
|
-
const resolveVPre = (info) => {
|
|
8
|
-
if (/:v-pre\b/.test(info)) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
if (/:no-v-pre\b/.test(info)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
};
|
|
16
|
-
exports.resolveVPre = resolveVPre;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.customComponentPlugin = void 0;
|
|
4
|
-
const htmlBlockRule_1 = require("./htmlBlockRule");
|
|
5
|
-
const htmlInlineRule_1 = require("./htmlInlineRule");
|
|
6
|
-
/**
|
|
7
|
-
* Replacing the default htmlBlock rule to allow using custom components
|
|
8
|
-
* in markdown
|
|
9
|
-
*/
|
|
10
|
-
const customComponentPlugin = (md) => {
|
|
11
|
-
// override default html block ruler
|
|
12
|
-
md.block.ruler.at('html_block', htmlBlockRule_1.htmlBlockRule, {
|
|
13
|
-
alt: ['paragraph', 'reference', 'blockquote'],
|
|
14
|
-
});
|
|
15
|
-
// override default html inline ruler
|
|
16
|
-
md.inline.ruler.at('html_inline', htmlInlineRule_1.htmlInlineRule);
|
|
17
|
-
};
|
|
18
|
-
exports.customComponentPlugin = customComponentPlugin;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.htmlBlockRule = void 0;
|
|
4
|
-
const blockNames = require("markdown-it/lib/common/html_blocks");
|
|
5
|
-
const htmlRe_1 = require("./htmlRe");
|
|
6
|
-
const inlineTags_1 = require("./inlineTags");
|
|
7
|
-
const vueReservedTags_1 = require("./vueReservedTags");
|
|
8
|
-
// Forked and modified from 'markdown-it/lib/rules_block/html_block.js'
|
|
9
|
-
// An array of opening and corresponding closing sequences for html tags,
|
|
10
|
-
// last argument defines whether it can terminate a paragraph or not
|
|
11
|
-
const HTML_SEQUENCES = [
|
|
12
|
-
[/^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true],
|
|
13
|
-
[/^<!--/, /-->/, true],
|
|
14
|
-
[/^<\?/, /\?>/, true],
|
|
15
|
-
[/^<![A-Z]/, />/, true],
|
|
16
|
-
[/^<!\[CDATA\[/, /\]\]>/, true],
|
|
17
|
-
// MODIFIED HERE: Treat vue reserved tags as block tags
|
|
18
|
-
[
|
|
19
|
-
new RegExp('^</?(' + vueReservedTags_1.vueReservedTags.join('|') + ')(?=(\\s|/?>|$))', 'i'),
|
|
20
|
-
/^$/,
|
|
21
|
-
true,
|
|
22
|
-
],
|
|
23
|
-
// MODIFIED HERE: Treat unknown tags as block tags (custom components), excluding known inline tags
|
|
24
|
-
[
|
|
25
|
-
new RegExp('^</?(?!(' + inlineTags_1.inlineTags.join('|') + ')(?![\\w-]))\\w[\\w-]*[\\s/>]'),
|
|
26
|
-
/^$/,
|
|
27
|
-
true,
|
|
28
|
-
],
|
|
29
|
-
[
|
|
30
|
-
new RegExp('^</?(' + blockNames.join('|') + ')(?=(\\s|/?>|$))', 'i'),
|
|
31
|
-
/^$/,
|
|
32
|
-
true,
|
|
33
|
-
],
|
|
34
|
-
[new RegExp(htmlRe_1.HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false],
|
|
35
|
-
];
|
|
36
|
-
const htmlBlockRule = (state, startLine, endLine, silent) => {
|
|
37
|
-
let i;
|
|
38
|
-
let nextLine;
|
|
39
|
-
let lineText;
|
|
40
|
-
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
41
|
-
let max = state.eMarks[startLine];
|
|
42
|
-
// if it's indented more than 3 spaces, it should be a code block
|
|
43
|
-
if (state.sCount[startLine] - state.blkIndent >= 4) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
if (!state.md.options.html) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
if (state.src.charCodeAt(pos) !== 0x3c /* < */) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
lineText = state.src.slice(pos, max);
|
|
53
|
-
for (i = 0; i < HTML_SEQUENCES.length; i++) {
|
|
54
|
-
if (HTML_SEQUENCES[i][0].test(lineText)) {
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (i === HTML_SEQUENCES.length) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (silent) {
|
|
62
|
-
// true if this sequence can be a terminator, false otherwise
|
|
63
|
-
return HTML_SEQUENCES[i][2];
|
|
64
|
-
}
|
|
65
|
-
nextLine = startLine + 1;
|
|
66
|
-
// If we are here - we detected HTML block.
|
|
67
|
-
// Let's roll down till block end.
|
|
68
|
-
if (!HTML_SEQUENCES[i][1].test(lineText)) {
|
|
69
|
-
for (; nextLine < endLine; nextLine++) {
|
|
70
|
-
if (state.sCount[nextLine] < state.blkIndent) {
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
74
|
-
max = state.eMarks[nextLine];
|
|
75
|
-
lineText = state.src.slice(pos, max);
|
|
76
|
-
if (HTML_SEQUENCES[i][1].test(lineText)) {
|
|
77
|
-
if (lineText.length !== 0) {
|
|
78
|
-
nextLine++;
|
|
79
|
-
}
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
state.line = nextLine;
|
|
85
|
-
const token = state.push('html_block', '', 0);
|
|
86
|
-
token.map = [startLine, nextLine];
|
|
87
|
-
token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
|
|
88
|
-
return true;
|
|
89
|
-
};
|
|
90
|
-
exports.htmlBlockRule = htmlBlockRule;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.htmlInlineRule = void 0;
|
|
4
|
-
const htmlRe_1 = require("./htmlRe");
|
|
5
|
-
// Forked and modified from 'markdown-it/lib/rules_inline/html_inline.js'
|
|
6
|
-
const isLetter = (ch) => {
|
|
7
|
-
const lc = ch | 0x20; // to lower case
|
|
8
|
-
return lc >= 0x61 /* a */ && lc <= 0x7a; /* z */
|
|
9
|
-
};
|
|
10
|
-
const htmlInlineRule = (state, silent) => {
|
|
11
|
-
const pos = state.pos;
|
|
12
|
-
if (!state.md.options.html) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
// Check start
|
|
16
|
-
const max = state.posMax;
|
|
17
|
-
if (state.src.charCodeAt(pos) !== 0x3c /* < */ || pos + 2 >= max) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
// Quick fail on second char
|
|
21
|
-
const ch = state.src.charCodeAt(pos + 1);
|
|
22
|
-
if (ch !== 0x21 /* ! */ &&
|
|
23
|
-
ch !== 0x3f /* ? */ &&
|
|
24
|
-
ch !== 0x2f /* / */ &&
|
|
25
|
-
!isLetter(ch)) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
// MODIFIED HERE: Tweak the original HTML_TAG_RE
|
|
29
|
-
const match = state.src.slice(pos).match(htmlRe_1.HTML_TAG_RE);
|
|
30
|
-
if (!match) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
if (!silent) {
|
|
34
|
-
const token = state.push('html_inline', '', 0);
|
|
35
|
-
token.content = state.src.slice(pos, pos + match[0].length);
|
|
36
|
-
}
|
|
37
|
-
state.pos += match[0].length;
|
|
38
|
-
return true;
|
|
39
|
-
};
|
|
40
|
-
exports.htmlInlineRule = htmlInlineRule;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.HTML_OPEN_CLOSE_TAG_RE = exports.HTML_TAG_RE = void 0;
|
|
5
|
-
// Forked and modified from 'markdown-it/lib/common/html_re.js'
|
|
6
|
-
// Regexps to match html elements
|
|
7
|
-
// MODIFIED HERE: Support `@` as the first char of attr name
|
|
8
|
-
const attr_name = '[a-zA-Z_:@][a-zA-Z0-9:._-]*';
|
|
9
|
-
const unquoted = '[^"\'=<>`\\x00-\\x20]+';
|
|
10
|
-
const single_quoted = "'[^']*'";
|
|
11
|
-
const double_quoted = '"[^"]*"';
|
|
12
|
-
const attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
|
|
13
|
-
const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
|
|
14
|
-
const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
|
|
15
|
-
const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
|
|
16
|
-
const comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
|
|
17
|
-
const processing = '<[?][\\s\\S]*?[?]>';
|
|
18
|
-
const declaration = '<![A-Z]+\\s+[^>]*>';
|
|
19
|
-
const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
|
|
20
|
-
exports.HTML_TAG_RE = new RegExp('^(?:' +
|
|
21
|
-
open_tag +
|
|
22
|
-
'|' +
|
|
23
|
-
close_tag +
|
|
24
|
-
'|' +
|
|
25
|
-
comment +
|
|
26
|
-
'|' +
|
|
27
|
-
processing +
|
|
28
|
-
'|' +
|
|
29
|
-
declaration +
|
|
30
|
-
'|' +
|
|
31
|
-
cdata +
|
|
32
|
-
')');
|
|
33
|
-
exports.HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./customComponentPlugin"), exports);
|
|
18
|
-
__exportStar(require("./htmlBlockRule"), exports);
|
|
19
|
-
__exportStar(require("./htmlInlineRule"), exports);
|
|
20
|
-
__exportStar(require("./htmlRe"), exports);
|
|
21
|
-
__exportStar(require("./inlineTags"), exports);
|
|
22
|
-
__exportStar(require("./vueReservedTags"), exports);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* According to markdown spec, all non-block html tags are treated as "inline"
|
|
3
|
-
* tags (wrapped with <p></p>), including those "unknown" tags
|
|
4
|
-
*
|
|
5
|
-
* Therefore, markdown-it processes "inline" tags and "unknown" tags in the same
|
|
6
|
-
* way, and does not care if a tag is "inline" or "unknown"
|
|
7
|
-
*
|
|
8
|
-
* As we want to take those "unknown" tags as custom components, we should
|
|
9
|
-
* treat them as "block" tags
|
|
10
|
-
*
|
|
11
|
-
* So we have to distinguish between "inline" and "unknown" tags ourselves
|
|
12
|
-
*
|
|
13
|
-
* The inline tags list comes from MDN
|
|
14
|
-
*
|
|
15
|
-
* @see https://spec.commonmark.org/0.29/#raw-html
|
|
16
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
|
|
17
|
-
*/
|
|
18
|
-
export declare const inlineTags: string[];
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.inlineTags = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* According to markdown spec, all non-block html tags are treated as "inline"
|
|
6
|
-
* tags (wrapped with <p></p>), including those "unknown" tags
|
|
7
|
-
*
|
|
8
|
-
* Therefore, markdown-it processes "inline" tags and "unknown" tags in the same
|
|
9
|
-
* way, and does not care if a tag is "inline" or "unknown"
|
|
10
|
-
*
|
|
11
|
-
* As we want to take those "unknown" tags as custom components, we should
|
|
12
|
-
* treat them as "block" tags
|
|
13
|
-
*
|
|
14
|
-
* So we have to distinguish between "inline" and "unknown" tags ourselves
|
|
15
|
-
*
|
|
16
|
-
* The inline tags list comes from MDN
|
|
17
|
-
*
|
|
18
|
-
* @see https://spec.commonmark.org/0.29/#raw-html
|
|
19
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
|
|
20
|
-
*/
|
|
21
|
-
exports.inlineTags = [
|
|
22
|
-
'a',
|
|
23
|
-
'abbr',
|
|
24
|
-
'acronym',
|
|
25
|
-
'audio',
|
|
26
|
-
'b',
|
|
27
|
-
'bdi',
|
|
28
|
-
'bdo',
|
|
29
|
-
'big',
|
|
30
|
-
'br',
|
|
31
|
-
'button',
|
|
32
|
-
'canvas',
|
|
33
|
-
'cite',
|
|
34
|
-
'code',
|
|
35
|
-
'data',
|
|
36
|
-
'datalist',
|
|
37
|
-
'del',
|
|
38
|
-
'dfn',
|
|
39
|
-
'em',
|
|
40
|
-
'embed',
|
|
41
|
-
'i',
|
|
42
|
-
/* iframe is treated as HTML blocks in markdown spec */
|
|
43
|
-
// 'iframe',
|
|
44
|
-
'img',
|
|
45
|
-
'input',
|
|
46
|
-
'ins',
|
|
47
|
-
'kbd',
|
|
48
|
-
'label',
|
|
49
|
-
'map',
|
|
50
|
-
'mark',
|
|
51
|
-
'meter',
|
|
52
|
-
'noscript',
|
|
53
|
-
'object',
|
|
54
|
-
'output',
|
|
55
|
-
'picture',
|
|
56
|
-
'progress',
|
|
57
|
-
'q',
|
|
58
|
-
'ruby',
|
|
59
|
-
's',
|
|
60
|
-
'samp',
|
|
61
|
-
'script',
|
|
62
|
-
'select',
|
|
63
|
-
'slot',
|
|
64
|
-
'small',
|
|
65
|
-
'span',
|
|
66
|
-
'strong',
|
|
67
|
-
'sub',
|
|
68
|
-
'sup',
|
|
69
|
-
'svg',
|
|
70
|
-
'template',
|
|
71
|
-
'textarea',
|
|
72
|
-
'time',
|
|
73
|
-
'u',
|
|
74
|
-
'tt',
|
|
75
|
-
'var',
|
|
76
|
-
'video',
|
|
77
|
-
'wbr',
|
|
78
|
-
];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vueReservedTags = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Vue reserved tags
|
|
6
|
-
*
|
|
7
|
-
* @see https://vuejs.org/api/built-in-components.html
|
|
8
|
-
*/
|
|
9
|
-
exports.vueReservedTags = [
|
|
10
|
-
'template',
|
|
11
|
-
'component',
|
|
12
|
-
'transition',
|
|
13
|
-
'transition-group',
|
|
14
|
-
'keep-alive',
|
|
15
|
-
'slot',
|
|
16
|
-
'teleport',
|
|
17
|
-
];
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { PluginWithOptions } from 'markdown-it';
|
|
2
|
-
/**
|
|
3
|
-
* Options for markdown-it-emoji
|
|
4
|
-
*
|
|
5
|
-
* @see https://github.com/markdown-it/markdown-it-emoji
|
|
6
|
-
*/
|
|
7
|
-
export interface EmojiPluginOptions {
|
|
8
|
-
/**
|
|
9
|
-
* rewrite available emoji definitions
|
|
10
|
-
*
|
|
11
|
-
* @example `{ name1: char1, name2: char2, ... }`
|
|
12
|
-
*/
|
|
13
|
-
defs?: Record<string, string>;
|
|
14
|
-
/**
|
|
15
|
-
* disable all emojis except whitelisted
|
|
16
|
-
*/
|
|
17
|
-
enabled?: string[];
|
|
18
|
-
/**
|
|
19
|
-
* rewrite default shortcuts
|
|
20
|
-
*
|
|
21
|
-
* @example `{ "smile": [ ":)", ":-)" ], "laughing": ":D" }`
|
|
22
|
-
*/
|
|
23
|
-
shortcuts?: Record<string, string | string[]>;
|
|
24
|
-
}
|
|
25
|
-
export declare const emojiPlugin: PluginWithOptions<EmojiPluginOptions>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { PluginWithOptions } from 'markdown-it';
|
|
2
|
-
import type { MarkdownSlugifyFunction } from '../types';
|
|
3
|
-
export interface ExtractHeadersPluginOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Heading level that going to be extracted to the `env`
|
|
6
|
-
*
|
|
7
|
-
* Should be a subset of markdown-it-anchor's `level` option
|
|
8
|
-
* to ensure the link is existed
|
|
9
|
-
*/
|
|
10
|
-
level?: number[];
|
|
11
|
-
/**
|
|
12
|
-
* A custom slugify function
|
|
13
|
-
*
|
|
14
|
-
* Should use the same slugify function with markdown-it-anchor
|
|
15
|
-
* to ensure the link is matched
|
|
16
|
-
*/
|
|
17
|
-
slugify?: MarkdownSlugifyFunction;
|
|
18
|
-
/**
|
|
19
|
-
* A function for formatting headers
|
|
20
|
-
*/
|
|
21
|
-
format?: (str: string) => string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Extracting markdown headers to env
|
|
25
|
-
*
|
|
26
|
-
* Would be used for generating sidebar nav and toc
|
|
27
|
-
*/
|
|
28
|
-
export declare const extractHeadersPlugin: PluginWithOptions<ExtractHeadersPluginOptions>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractHeadersPlugin = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
/**
|
|
6
|
-
* Extracting markdown headers to env
|
|
7
|
-
*
|
|
8
|
-
* Would be used for generating sidebar nav and toc
|
|
9
|
-
*/
|
|
10
|
-
const extractHeadersPlugin = (md, { level = [2, 3], slugify = utils_1.vuepressSlugify, format, } = {}) => {
|
|
11
|
-
let headers;
|
|
12
|
-
// push the rule to the end of the chain
|
|
13
|
-
// resolve headers from the parsed tokens
|
|
14
|
-
md.core.ruler.push('resolveExtractHeaders', (state) => {
|
|
15
|
-
headers = (0, utils_1.resolveHeadersFromTokens)(state.tokens, {
|
|
16
|
-
level,
|
|
17
|
-
allowHtml: false,
|
|
18
|
-
escapeText: false,
|
|
19
|
-
slugify,
|
|
20
|
-
format,
|
|
21
|
-
});
|
|
22
|
-
return true;
|
|
23
|
-
});
|
|
24
|
-
// extract headers to env
|
|
25
|
-
const render = md.render.bind(md);
|
|
26
|
-
md.render = (src, env = {}) => {
|
|
27
|
-
const result = render(src, env);
|
|
28
|
-
env.headers = headers;
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.extractHeadersPlugin = extractHeadersPlugin;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractTitlePlugin = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
/**
|
|
6
|
-
* Extracting markdown title to env
|
|
7
|
-
*/
|
|
8
|
-
const extractTitlePlugin = (md) => {
|
|
9
|
-
let title;
|
|
10
|
-
// push the rule to the end of the chain
|
|
11
|
-
// resolve title from the parsed tokens
|
|
12
|
-
md.core.ruler.push('resolveExtractTitle', (state) => {
|
|
13
|
-
const tokenIdx = state.tokens.findIndex((token) => token.tag === 'h1');
|
|
14
|
-
if (tokenIdx > -1) {
|
|
15
|
-
title = (0, utils_1.resolveTitleFromToken)(state.tokens[tokenIdx + 1], {
|
|
16
|
-
escapeText: false,
|
|
17
|
-
allowHtml: false,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
title = '';
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
});
|
|
25
|
-
// extract title to env
|
|
26
|
-
const render = md.render.bind(md);
|
|
27
|
-
md.render = (src, env = {}) => {
|
|
28
|
-
const result = render(src, env);
|
|
29
|
-
env.title = env.frontmatter?.title ?? title;
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
exports.extractTitlePlugin = extractTitlePlugin;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PluginWithOptions } from 'markdown-it';
|
|
2
|
-
export interface HoistTagsPluginOptions {
|
|
3
|
-
customBlocks?: string[];
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Avoid rendering vue SFC script / style blocks
|
|
7
|
-
*
|
|
8
|
-
* Extract them into env
|
|
9
|
-
*
|
|
10
|
-
* Hoist them to vue SFC root level in following process
|
|
11
|
-
*/
|
|
12
|
-
export declare const hoistTagsPlugin: PluginWithOptions<HoistTagsPluginOptions>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hoistTagsPlugin = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Avoid rendering vue SFC script / style blocks
|
|
6
|
-
*
|
|
7
|
-
* Extract them into env
|
|
8
|
-
*
|
|
9
|
-
* Hoist them to vue SFC root level in following process
|
|
10
|
-
*/
|
|
11
|
-
const hoistTagsPlugin = (md, { customBlocks = [] } = {}) => {
|
|
12
|
-
// hoist <script>, <style> and other user defined tags
|
|
13
|
-
const hoistTags = Array.from(new Set(['script', 'style', ...customBlocks]));
|
|
14
|
-
const hoistTagsRegexp = new RegExp(`^<(${hoistTags.join('|')})(?=(\\s|>|$))`, 'i');
|
|
15
|
-
const rawRule = md.renderer.rules.html_block;
|
|
16
|
-
md.renderer.rules.html_block = (tokens, idx, options, env, self) => {
|
|
17
|
-
const content = tokens[idx].content;
|
|
18
|
-
const hoistedTags = env.hoistedTags || (env.hoistedTags = []);
|
|
19
|
-
// record the hoisted tags to env and do not render them
|
|
20
|
-
if (hoistTagsRegexp.test(content.trim())) {
|
|
21
|
-
hoistedTags.push(content);
|
|
22
|
-
return '';
|
|
23
|
-
}
|
|
24
|
-
return rawRule(tokens, idx, options, env, self);
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
exports.hoistTagsPlugin = hoistTagsPlugin;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createImportCodeBlockRule = void 0;
|
|
4
|
-
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
// min length of the import code syntax, i.e. '@[code]()'
|
|
6
|
-
const MIN_LENGTH = 9;
|
|
7
|
-
// char codes of '@[code'
|
|
8
|
-
const START_CODES = [64, 91, 99, 111, 100, 101];
|
|
9
|
-
// regexp to match the import syntax
|
|
10
|
-
const SYNTAX_RE = /^@\[code(?:{(?:(\d+)?-(\d+)?)})?(?: ([^\]]+))?\]\(([^)]*)\)/;
|
|
11
|
-
const createImportCodeBlockRule = ({ handleImportPath = (str) => str }) => (state, startLine, endLine, silent) => {
|
|
12
|
-
// if it's indented more than 3 spaces, it should be a code block
|
|
13
|
-
/* istanbul ignore if */
|
|
14
|
-
if (state.sCount[startLine] - state.blkIndent >= 4) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
const pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
18
|
-
const max = state.eMarks[startLine];
|
|
19
|
-
// return false if the length is shorter than min length
|
|
20
|
-
if (pos + MIN_LENGTH > max)
|
|
21
|
-
return false;
|
|
22
|
-
// check if it's matched the start
|
|
23
|
-
for (let i = 0; i < START_CODES.length; i += 1) {
|
|
24
|
-
if (state.src.charCodeAt(pos + i) !== START_CODES[i]) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// check if it's matched the syntax
|
|
29
|
-
const match = state.src.slice(pos, max).match(SYNTAX_RE);
|
|
30
|
-
if (!match)
|
|
31
|
-
return false;
|
|
32
|
-
// return true as we have matched the syntax
|
|
33
|
-
if (silent)
|
|
34
|
-
return true;
|
|
35
|
-
const [, lineStart, lineEnd, info, importPath] = match;
|
|
36
|
-
const meta = {
|
|
37
|
-
importPath: handleImportPath(importPath),
|
|
38
|
-
lineStart: lineStart ? Number.parseInt(lineStart, 10) : 0,
|
|
39
|
-
lineEnd: lineEnd ? Number.parseInt(lineEnd, 10) : undefined,
|
|
40
|
-
};
|
|
41
|
-
// create a import_code token
|
|
42
|
-
const token = state.push('import_code', 'code', 0);
|
|
43
|
-
// use user specified info, or fallback to file ext
|
|
44
|
-
token.info = info ?? utils_1.path.extname(meta.importPath).slice(1);
|
|
45
|
-
token.markup = '```';
|
|
46
|
-
token.map = [startLine, startLine + 1];
|
|
47
|
-
// store token meta to be used in renderer rule
|
|
48
|
-
token.meta = meta;
|
|
49
|
-
state.line = startLine + 1;
|
|
50
|
-
return true;
|
|
51
|
-
};
|
|
52
|
-
exports.createImportCodeBlockRule = createImportCodeBlockRule;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { PluginWithOptions } from 'markdown-it';
|
|
2
|
-
export interface ImportCodePluginOptions {
|
|
3
|
-
/**
|
|
4
|
-
* A function to handle the import path
|
|
5
|
-
*/
|
|
6
|
-
handleImportPath?: (str: string) => string;
|
|
7
|
-
}
|
|
8
|
-
export declare const importCodePlugin: PluginWithOptions<ImportCodePluginOptions>;
|