@nuxtjs/mdc 0.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/LICENSE +21 -0
- package/README.md +64 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +55 -0
- package/dist/module.d.ts +55 -0
- package/dist/module.json +5 -0
- package/dist/module.mjs +174 -0
- package/dist/runtime/components/MDC.vue +36 -0
- package/dist/runtime/components/MDCRenderer.vue +293 -0
- package/dist/runtime/components/MDCRenderer.vue.d.ts +92 -0
- package/dist/runtime/components/MDCSlot.vue +60 -0
- package/dist/runtime/components/MDCSlot.vue.d.ts +5 -0
- package/dist/runtime/components/prose/ProseA.vue +22 -0
- package/dist/runtime/components/prose/ProseBlockquote.vue +5 -0
- package/dist/runtime/components/prose/ProseCode.vue +3 -0
- package/dist/runtime/components/prose/ProseEm.vue +5 -0
- package/dist/runtime/components/prose/ProseH1.vue +20 -0
- package/dist/runtime/components/prose/ProseH2.vue +20 -0
- package/dist/runtime/components/prose/ProseH3.vue +20 -0
- package/dist/runtime/components/prose/ProseH4.vue +20 -0
- package/dist/runtime/components/prose/ProseH5.vue +20 -0
- package/dist/runtime/components/prose/ProseH6.vue +20 -0
- package/dist/runtime/components/prose/ProseHr.vue +3 -0
- package/dist/runtime/components/prose/ProseImg.vue +42 -0
- package/dist/runtime/components/prose/ProseLi.vue +3 -0
- package/dist/runtime/components/prose/ProseOl.vue +5 -0
- package/dist/runtime/components/prose/ProseP.vue +3 -0
- package/dist/runtime/components/prose/ProsePre.vue +39 -0
- package/dist/runtime/components/prose/ProseStrong.vue +5 -0
- package/dist/runtime/components/prose/ProseTable.vue +5 -0
- package/dist/runtime/components/prose/ProseTbody.vue +5 -0
- package/dist/runtime/components/prose/ProseTd.vue +5 -0
- package/dist/runtime/components/prose/ProseTh.vue +5 -0
- package/dist/runtime/components/prose/ProseThead.vue +5 -0
- package/dist/runtime/components/prose/ProseTr.vue +5 -0
- package/dist/runtime/components/prose/ProseUl.vue +5 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.mjs +3 -0
- package/dist/runtime/parser/compiler.d.ts +1 -0
- package/dist/runtime/parser/compiler.mjs +78 -0
- package/dist/runtime/parser/handlers/code.d.ts +5 -0
- package/dist/runtime/parser/handlers/code.mjs +31 -0
- package/dist/runtime/parser/handlers/containerComponent.d.ts +10 -0
- package/dist/runtime/parser/handlers/containerComponent.mjs +15 -0
- package/dist/runtime/parser/handlers/emphasis.d.ts +6 -0
- package/dist/runtime/parser/handlers/emphasis.mjs +10 -0
- package/dist/runtime/parser/handlers/html.d.ts +3 -0
- package/dist/runtime/parser/handlers/html.mjs +14 -0
- package/dist/runtime/parser/handlers/image.d.ts +6 -0
- package/dist/runtime/parser/handlers/image.mjs +13 -0
- package/dist/runtime/parser/handlers/index.d.ts +22 -0
- package/dist/runtime/parser/handlers/index.mjs +22 -0
- package/dist/runtime/parser/handlers/inlineCode.d.ts +6 -0
- package/dist/runtime/parser/handlers/inlineCode.mjs +12 -0
- package/dist/runtime/parser/handlers/link.d.ts +6 -0
- package/dist/runtime/parser/handlers/link.mjs +18 -0
- package/dist/runtime/parser/handlers/list.d.ts +4 -0
- package/dist/runtime/parser/handlers/list.mjs +26 -0
- package/dist/runtime/parser/handlers/paragraph.d.ts +4 -0
- package/dist/runtime/parser/handlers/paragraph.mjs +19 -0
- package/dist/runtime/parser/handlers/strong.d.ts +6 -0
- package/dist/runtime/parser/handlers/strong.mjs +10 -0
- package/dist/runtime/parser/handlers/utils.d.ts +19 -0
- package/dist/runtime/parser/handlers/utils.mjs +33 -0
- package/dist/runtime/parser/index.d.ts +11 -0
- package/dist/runtime/parser/index.mjs +60 -0
- package/dist/runtime/parser/options.d.ts +2 -0
- package/dist/runtime/parser/options.mjs +50 -0
- package/dist/runtime/parser/shiki.d.ts +8 -0
- package/dist/runtime/parser/shiki.mjs +55 -0
- package/dist/runtime/parser/toc.d.ts +3 -0
- package/dist/runtime/parser/toc.mjs +59 -0
- package/dist/runtime/parser/utils/html-tags-list.d.ts +2 -0
- package/dist/runtime/parser/utils/html-tags-list.mjs +119 -0
- package/dist/runtime/parser/utils/plugins.d.ts +3 -0
- package/dist/runtime/parser/utils/plugins.mjs +10 -0
- package/dist/runtime/parser/utils/props.d.ts +5 -0
- package/dist/runtime/parser/utils/props.mjs +33 -0
- package/dist/runtime/shiki/event-handler.d.ts +8 -0
- package/dist/runtime/shiki/event-handler.mjs +15 -0
- package/dist/runtime/shiki/highlighter.d.ts +25 -0
- package/dist/runtime/shiki/highlighter.mjs +298 -0
- package/dist/runtime/shiki/mdc.tmLanguage.d.ts +323 -0
- package/dist/runtime/shiki/mdc.tmLanguage.mjs +582 -0
- package/dist/runtime/shiki/types.d.ts +32 -0
- package/dist/runtime/shiki/types.mjs +0 -0
- package/dist/runtime/types/hast.d.ts +255 -0
- package/dist/runtime/types/hast.mjs +0 -0
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/types/index.mjs +3 -0
- package/dist/runtime/types/parser.d.ts +30 -0
- package/dist/runtime/types/parser.mjs +0 -0
- package/dist/runtime/types/toc.d.ts +12 -0
- package/dist/runtime/types/toc.mjs +0 -0
- package/dist/runtime/types/tree.d.ts +17 -0
- package/dist/runtime/types/tree.mjs +0 -0
- package/dist/runtime/types/unist.d.ts +107 -0
- package/dist/runtime/types/unist.mjs +0 -0
- package/dist/runtime/utils/ast.d.ts +6 -0
- package/dist/runtime/utils/ast.mjs +29 -0
- package/dist/runtime/utils/node.d.ts +37 -0
- package/dist/runtime/utils/node.mjs +75 -0
- package/dist/runtime/utils/slot.d.ts +3 -0
- package/dist/runtime/utils/slot.mjs +8 -0
- package/dist/runtime/utils/ssrSlot.d.ts +1 -0
- package/dist/runtime/utils/ssrSlot.mjs +8 -0
- package/dist/types.d.mts +7 -0
- package/dist/types.d.ts +7 -0
- package/package.json +99 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { getHighlighter, BUNDLED_LANGUAGES, BUNDLED_THEMES, FontStyle } from "shiki-es";
|
|
2
|
+
import { consola } from "consola";
|
|
3
|
+
import mdcTMLanguage from "./mdc.tmLanguage.mjs";
|
|
4
|
+
const logger = consola.withTag("@nuxtjs/mdc");
|
|
5
|
+
const resolveLang = (lang) => BUNDLED_LANGUAGES.find((l) => l.id === lang || l.aliases?.includes(lang));
|
|
6
|
+
const resolveTheme = (theme) => {
|
|
7
|
+
if (!theme) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (typeof theme === "string") {
|
|
11
|
+
theme = {
|
|
12
|
+
default: theme
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return Object.entries(theme).reduce((acc, [key, value]) => {
|
|
16
|
+
acc[key] = BUNDLED_THEMES.find((t) => t === value);
|
|
17
|
+
return acc;
|
|
18
|
+
}, {});
|
|
19
|
+
};
|
|
20
|
+
export const useShikiHighlighter = createSingleton((opts) => {
|
|
21
|
+
const { theme, preload } = opts || {};
|
|
22
|
+
let promise;
|
|
23
|
+
const getShikiHighlighter = () => {
|
|
24
|
+
if (!promise) {
|
|
25
|
+
promise = getHighlighter({
|
|
26
|
+
theme: theme?.default || theme || "dark-plus",
|
|
27
|
+
langs: [
|
|
28
|
+
...preload || [],
|
|
29
|
+
"diff",
|
|
30
|
+
"json",
|
|
31
|
+
"js",
|
|
32
|
+
"ts",
|
|
33
|
+
"css",
|
|
34
|
+
"shell",
|
|
35
|
+
"html",
|
|
36
|
+
"md",
|
|
37
|
+
"yaml",
|
|
38
|
+
"vue",
|
|
39
|
+
{
|
|
40
|
+
id: "md",
|
|
41
|
+
scopeName: "text.markdown.mdc",
|
|
42
|
+
path: "mdc.tmLanguage.json",
|
|
43
|
+
aliases: ["markdown", "md", "mdc"],
|
|
44
|
+
grammar: mdcTMLanguage
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}).then((highlighter) => {
|
|
48
|
+
const themes = Object.values(typeof theme === "string" ? { default: theme } : theme || {});
|
|
49
|
+
if (themes.length) {
|
|
50
|
+
return Promise.all(themes.map((theme2) => highlighter.loadTheme(theme2))).then(() => highlighter);
|
|
51
|
+
}
|
|
52
|
+
return highlighter;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return promise;
|
|
56
|
+
};
|
|
57
|
+
const splitCodeToLines = (code) => {
|
|
58
|
+
const lines = code.split(/\r\n|\r|\n/);
|
|
59
|
+
return [...lines.map((line) => [{ content: line }])];
|
|
60
|
+
};
|
|
61
|
+
const getHighlightedTokens = async (code, lang, theme2) => {
|
|
62
|
+
const highlighter = await getShikiHighlighter();
|
|
63
|
+
code = code.replace(/\n+$/, "");
|
|
64
|
+
lang = resolveLang(lang || "")?.id || lang;
|
|
65
|
+
theme2 = resolveTheme(theme2 || "") || { default: highlighter.getTheme() };
|
|
66
|
+
const newThemes = Object.values(theme2).filter((t) => !highlighter.getLoadedThemes().includes(t));
|
|
67
|
+
if (newThemes.length) {
|
|
68
|
+
await Promise.all(newThemes.map(highlighter.loadTheme));
|
|
69
|
+
}
|
|
70
|
+
const result = {
|
|
71
|
+
code,
|
|
72
|
+
lang,
|
|
73
|
+
theme: Object.fromEntries(Object.entries(theme2).map(([n, t]) => [n, highlighter.getTheme(t)])),
|
|
74
|
+
tokens: splitCodeToLines(code)
|
|
75
|
+
};
|
|
76
|
+
if (!lang) {
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
if (!highlighter.getLoadedLanguages().includes(lang)) {
|
|
80
|
+
const languageRegistration = resolveLang(lang);
|
|
81
|
+
if (languageRegistration) {
|
|
82
|
+
await highlighter.loadLanguage(languageRegistration);
|
|
83
|
+
} else {
|
|
84
|
+
logger.warn(`Language '${lang}' is not supported by shiki. Skipping highlight.`);
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const coloredTokens = Object.entries(theme2).map(([key, theme3]) => {
|
|
89
|
+
const tokens = highlighter.codeToThemedTokens(code, lang, theme3, { includeExplanation: false }).map((line) => line.map((token) => ({
|
|
90
|
+
content: token.content,
|
|
91
|
+
style: {
|
|
92
|
+
[key]: { color: token.color, fontStyle: token.fontStyle }
|
|
93
|
+
}
|
|
94
|
+
})));
|
|
95
|
+
return {
|
|
96
|
+
key,
|
|
97
|
+
theme: theme3,
|
|
98
|
+
tokens
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
const highlightedCode = [];
|
|
102
|
+
for (const line in coloredTokens[0].tokens) {
|
|
103
|
+
highlightedCode[line] = coloredTokens.reduce((acc, color) => {
|
|
104
|
+
return mergeLines({
|
|
105
|
+
key: coloredTokens[0].key,
|
|
106
|
+
tokens: acc
|
|
107
|
+
}, {
|
|
108
|
+
key: color.key,
|
|
109
|
+
tokens: color.tokens[line]
|
|
110
|
+
});
|
|
111
|
+
}, coloredTokens[0].tokens[line]);
|
|
112
|
+
}
|
|
113
|
+
result.tokens = highlightedCode;
|
|
114
|
+
return result;
|
|
115
|
+
};
|
|
116
|
+
const getHighlightedAST = async (code, lang, theme2, opts2) => {
|
|
117
|
+
const { tokens, theme: themeMap } = await getHighlightedTokens(code, lang, theme2);
|
|
118
|
+
const { highlights = [], styleMap = {} } = opts2 || {};
|
|
119
|
+
const className = Object.values(themeMap).map((th) => th.name).join("_").replace(".", "");
|
|
120
|
+
styleMap[className] = {
|
|
121
|
+
style: Object.entries(themeMap).reduce((acc, [key, th]) => {
|
|
122
|
+
acc[key] = {
|
|
123
|
+
background: th.bg,
|
|
124
|
+
color: th.fg
|
|
125
|
+
};
|
|
126
|
+
return acc;
|
|
127
|
+
}, {}),
|
|
128
|
+
className
|
|
129
|
+
};
|
|
130
|
+
const tree = tokens.map((line, lineIndex) => {
|
|
131
|
+
if (lineIndex !== tokens.length - 1) {
|
|
132
|
+
if (line.length === 0) {
|
|
133
|
+
line.push({ content: "" });
|
|
134
|
+
}
|
|
135
|
+
line[line.length - 1].content += "\n";
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
type: "element",
|
|
139
|
+
tagName: "span",
|
|
140
|
+
properties: {
|
|
141
|
+
class: ["line", highlights.includes(lineIndex + 1) ? "highlight" : ""].join(" ").trim(),
|
|
142
|
+
line: lineIndex + 1
|
|
143
|
+
},
|
|
144
|
+
children: line.map(tokenSpan)
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
return {
|
|
148
|
+
tree,
|
|
149
|
+
className
|
|
150
|
+
};
|
|
151
|
+
function getSpanProps(token) {
|
|
152
|
+
if (!token.style) {
|
|
153
|
+
return {};
|
|
154
|
+
}
|
|
155
|
+
const key = Object.values(token.style).map((themeStyle) => Object.values(themeStyle).join("")).join("");
|
|
156
|
+
if (!styleMap[key]) {
|
|
157
|
+
styleMap[key] = {
|
|
158
|
+
style: token.style,
|
|
159
|
+
// Using the hash value of the style as the className,
|
|
160
|
+
// ensure that the className remains stable over multiple compilations,
|
|
161
|
+
// which facilitates content caching.
|
|
162
|
+
className: "ct-" + hash(key)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return { class: styleMap[key].className };
|
|
166
|
+
}
|
|
167
|
+
function tokenSpan(token) {
|
|
168
|
+
return {
|
|
169
|
+
type: "element",
|
|
170
|
+
tagName: "span",
|
|
171
|
+
properties: getSpanProps(token),
|
|
172
|
+
children: [{ type: "text", value: token.content }]
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const getHighlightedCode = async (code, lang, theme2, opts2) => {
|
|
177
|
+
const styleMap = opts2?.styleMap || {};
|
|
178
|
+
const highlights = opts2?.highlights || [];
|
|
179
|
+
const { tree, className } = await getHighlightedAST(code, lang, theme2, { styleMap, highlights });
|
|
180
|
+
function renderNode(node) {
|
|
181
|
+
if (node.type === "text") {
|
|
182
|
+
return node.value.replace(/</g, "<").replace(/>/g, ">");
|
|
183
|
+
}
|
|
184
|
+
const children = node.children.map(renderNode).join("");
|
|
185
|
+
return `<${node.tag} class="${node.props.class}">${children}</${node.tag}>`;
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
code: tree.map(renderNode).join(""),
|
|
189
|
+
className,
|
|
190
|
+
styles: generateStyles(styleMap)
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
const generateStyles = (styleMap) => {
|
|
194
|
+
const styles = [];
|
|
195
|
+
for (const styleToken of Object.values(styleMap)) {
|
|
196
|
+
const defaultStyle = styleToken.style.default;
|
|
197
|
+
const hasColor = !!defaultStyle?.color;
|
|
198
|
+
const hasBold = isBold(defaultStyle);
|
|
199
|
+
const hasItalic = isItalic(defaultStyle);
|
|
200
|
+
const hasUnderline = isUnderline(defaultStyle);
|
|
201
|
+
const themeStyles = Object.entries(styleToken.style).map(([variant, style]) => {
|
|
202
|
+
const styleText = [
|
|
203
|
+
// If the default theme has a style, but the current theme does not have one,
|
|
204
|
+
// we need to override to reset style
|
|
205
|
+
["color", style.color || (hasColor ? "unset" : "")],
|
|
206
|
+
["font-weight", isBold(style) ? "bold" : hasBold ? "unset" : ""],
|
|
207
|
+
["font-style", isItalic(style) ? "italic" : hasItalic ? "unset" : ""],
|
|
208
|
+
["text-decoration", isUnderline(style) ? "bold" : hasUnderline ? "unset" : ""],
|
|
209
|
+
["background", style.background || ""]
|
|
210
|
+
].filter((kv) => kv[1]).map((kv) => kv.join(":") + ";").join("");
|
|
211
|
+
return { variant, styleText };
|
|
212
|
+
});
|
|
213
|
+
const defaultThemeStyle = themeStyles.find((themeStyle) => themeStyle.variant === "default");
|
|
214
|
+
themeStyles.forEach((themeStyle) => {
|
|
215
|
+
if (themeStyle.variant === "default") {
|
|
216
|
+
styles.push(`.${styleToken.className}{${themeStyle.styleText}}`);
|
|
217
|
+
} else if (themeStyle.styleText !== defaultThemeStyle?.styleText) {
|
|
218
|
+
styles.push(`.${themeStyle.variant} .${styleToken.className}{${themeStyle.styleText}}`);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return styles.join("\n");
|
|
223
|
+
};
|
|
224
|
+
return {
|
|
225
|
+
getHighlightedTokens,
|
|
226
|
+
getHighlightedAST,
|
|
227
|
+
getHighlightedCode,
|
|
228
|
+
generateStyles
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
function mergeLines(line1, line2) {
|
|
232
|
+
const mergedTokens = [];
|
|
233
|
+
const right = {
|
|
234
|
+
key: line1.key,
|
|
235
|
+
tokens: line1.tokens.slice()
|
|
236
|
+
};
|
|
237
|
+
const left = {
|
|
238
|
+
key: line2.key,
|
|
239
|
+
tokens: line2.tokens.slice()
|
|
240
|
+
};
|
|
241
|
+
let index = 0;
|
|
242
|
+
while (index < right.tokens.length) {
|
|
243
|
+
const rightToken = right.tokens[index];
|
|
244
|
+
const leftToken = left.tokens[index];
|
|
245
|
+
if (rightToken.content === leftToken.content) {
|
|
246
|
+
mergedTokens.push({
|
|
247
|
+
content: rightToken.content,
|
|
248
|
+
style: {
|
|
249
|
+
...right.tokens[index].style,
|
|
250
|
+
...left.tokens[index].style
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
index += 1;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (rightToken.content.startsWith(leftToken.content)) {
|
|
257
|
+
const nextRightToken = {
|
|
258
|
+
...rightToken,
|
|
259
|
+
content: rightToken.content.slice(leftToken.content.length)
|
|
260
|
+
};
|
|
261
|
+
rightToken.content = leftToken.content;
|
|
262
|
+
right.tokens.splice(index + 1, 0, nextRightToken);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (leftToken.content.startsWith(rightToken.content)) {
|
|
266
|
+
const nextLeftToken = {
|
|
267
|
+
...leftToken,
|
|
268
|
+
content: leftToken.content.slice(rightToken.content.length)
|
|
269
|
+
};
|
|
270
|
+
leftToken.content = rightToken.content;
|
|
271
|
+
left.tokens.splice(index + 1, 0, nextLeftToken);
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
throw new Error("Unexpected token");
|
|
275
|
+
}
|
|
276
|
+
return mergedTokens;
|
|
277
|
+
}
|
|
278
|
+
function isBold(style) {
|
|
279
|
+
return style && style.fontStyle === FontStyle.Bold;
|
|
280
|
+
}
|
|
281
|
+
function isItalic(style) {
|
|
282
|
+
return style && style.fontStyle === FontStyle.Italic;
|
|
283
|
+
}
|
|
284
|
+
function isUnderline(style) {
|
|
285
|
+
return style && style.fontStyle === FontStyle.Underline;
|
|
286
|
+
}
|
|
287
|
+
function hash(str) {
|
|
288
|
+
return Array.from(str).reduce((s, c) => Math.imul(31, s) + c.charCodeAt(0) | 0, 0).toString().slice(-6);
|
|
289
|
+
}
|
|
290
|
+
function createSingleton(fn) {
|
|
291
|
+
let instance;
|
|
292
|
+
return (...args) => {
|
|
293
|
+
if (!instance) {
|
|
294
|
+
instance = fn(...args);
|
|
295
|
+
}
|
|
296
|
+
return instance;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
declare const grammar: {
|
|
2
|
+
information_for_contributors: string[];
|
|
3
|
+
version: string;
|
|
4
|
+
name: string;
|
|
5
|
+
injectionSelector: string;
|
|
6
|
+
scopeName: string;
|
|
7
|
+
patterns: {
|
|
8
|
+
include: string;
|
|
9
|
+
}[];
|
|
10
|
+
repository: {
|
|
11
|
+
block: {
|
|
12
|
+
comment: string;
|
|
13
|
+
patterns: {
|
|
14
|
+
include: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
inline: {
|
|
18
|
+
patterns: {
|
|
19
|
+
include: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
markdown_attributes: {
|
|
23
|
+
match: string;
|
|
24
|
+
name: string;
|
|
25
|
+
captures: {
|
|
26
|
+
"4": {
|
|
27
|
+
patterns: {
|
|
28
|
+
include: string;
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
span: {
|
|
34
|
+
match: string;
|
|
35
|
+
name: string;
|
|
36
|
+
captures: {
|
|
37
|
+
"2": {
|
|
38
|
+
name: string;
|
|
39
|
+
};
|
|
40
|
+
"4": {
|
|
41
|
+
patterns: {
|
|
42
|
+
include: string;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
attributes: {
|
|
48
|
+
match: string;
|
|
49
|
+
name: string;
|
|
50
|
+
captures: {
|
|
51
|
+
"3": {
|
|
52
|
+
patterns: {
|
|
53
|
+
include: string;
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
component_inline: {
|
|
59
|
+
match: string;
|
|
60
|
+
name: string;
|
|
61
|
+
captures: {
|
|
62
|
+
"2": {
|
|
63
|
+
name: string;
|
|
64
|
+
};
|
|
65
|
+
"3": {
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
68
|
+
"5": {
|
|
69
|
+
patterns: {
|
|
70
|
+
include: string;
|
|
71
|
+
}[];
|
|
72
|
+
};
|
|
73
|
+
"6": {
|
|
74
|
+
patterns: {
|
|
75
|
+
include: string;
|
|
76
|
+
}[];
|
|
77
|
+
};
|
|
78
|
+
"7": {
|
|
79
|
+
patterns: {
|
|
80
|
+
include: string;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
"8": {
|
|
84
|
+
patterns: {
|
|
85
|
+
include: string;
|
|
86
|
+
}[];
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
component_block: {
|
|
91
|
+
begin: string;
|
|
92
|
+
name: string;
|
|
93
|
+
end: string;
|
|
94
|
+
beginCaptures: {
|
|
95
|
+
"4": {
|
|
96
|
+
name: string;
|
|
97
|
+
};
|
|
98
|
+
"5": {
|
|
99
|
+
patterns: {
|
|
100
|
+
include: string;
|
|
101
|
+
}[];
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
patterns: {
|
|
105
|
+
include: string;
|
|
106
|
+
}[];
|
|
107
|
+
};
|
|
108
|
+
content: {
|
|
109
|
+
begin: string;
|
|
110
|
+
while: string;
|
|
111
|
+
contentName: string;
|
|
112
|
+
patterns: ({
|
|
113
|
+
begin: string;
|
|
114
|
+
end: string;
|
|
115
|
+
patterns: {
|
|
116
|
+
include: string;
|
|
117
|
+
}[];
|
|
118
|
+
match?: undefined;
|
|
119
|
+
captures?: undefined;
|
|
120
|
+
comment?: undefined;
|
|
121
|
+
include?: undefined;
|
|
122
|
+
} | {
|
|
123
|
+
match: string;
|
|
124
|
+
captures: {
|
|
125
|
+
"2": {
|
|
126
|
+
name: string;
|
|
127
|
+
};
|
|
128
|
+
"3": {
|
|
129
|
+
name: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
begin?: undefined;
|
|
133
|
+
end?: undefined;
|
|
134
|
+
patterns?: undefined;
|
|
135
|
+
comment?: undefined;
|
|
136
|
+
include?: undefined;
|
|
137
|
+
} | {
|
|
138
|
+
comment: string;
|
|
139
|
+
include: string;
|
|
140
|
+
begin?: undefined;
|
|
141
|
+
end?: undefined;
|
|
142
|
+
patterns?: undefined;
|
|
143
|
+
match?: undefined;
|
|
144
|
+
captures?: undefined;
|
|
145
|
+
})[];
|
|
146
|
+
};
|
|
147
|
+
attribute: {
|
|
148
|
+
patterns: {
|
|
149
|
+
match: string;
|
|
150
|
+
captures: {
|
|
151
|
+
"2": {
|
|
152
|
+
name: string;
|
|
153
|
+
};
|
|
154
|
+
"3": {
|
|
155
|
+
patterns: {
|
|
156
|
+
include: string;
|
|
157
|
+
}[];
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
}[];
|
|
161
|
+
};
|
|
162
|
+
"attribute-interior": {
|
|
163
|
+
comment: string;
|
|
164
|
+
patterns: {
|
|
165
|
+
begin: string;
|
|
166
|
+
beginCaptures: {
|
|
167
|
+
"0": {
|
|
168
|
+
name: string;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
end: string;
|
|
172
|
+
patterns: ({
|
|
173
|
+
match: string;
|
|
174
|
+
name: string;
|
|
175
|
+
begin?: undefined;
|
|
176
|
+
beginCaptures?: undefined;
|
|
177
|
+
end?: undefined;
|
|
178
|
+
endCaptures?: undefined;
|
|
179
|
+
patterns?: undefined;
|
|
180
|
+
} | {
|
|
181
|
+
begin: string;
|
|
182
|
+
beginCaptures: {
|
|
183
|
+
"0": {
|
|
184
|
+
name: string;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
end: string;
|
|
188
|
+
endCaptures: {
|
|
189
|
+
"0": {
|
|
190
|
+
name: string;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
name: string;
|
|
194
|
+
patterns: {
|
|
195
|
+
include: string;
|
|
196
|
+
}[];
|
|
197
|
+
match?: undefined;
|
|
198
|
+
})[];
|
|
199
|
+
}[];
|
|
200
|
+
};
|
|
201
|
+
entities: {
|
|
202
|
+
comment: string;
|
|
203
|
+
patterns: ({
|
|
204
|
+
captures: {
|
|
205
|
+
"1": {
|
|
206
|
+
name: string;
|
|
207
|
+
};
|
|
208
|
+
"912": {
|
|
209
|
+
name: string;
|
|
210
|
+
};
|
|
211
|
+
"3"?: undefined;
|
|
212
|
+
};
|
|
213
|
+
comment: string;
|
|
214
|
+
match: string;
|
|
215
|
+
name: string;
|
|
216
|
+
} | {
|
|
217
|
+
captures: {
|
|
218
|
+
"1": {
|
|
219
|
+
name: string;
|
|
220
|
+
};
|
|
221
|
+
"3": {
|
|
222
|
+
name: string;
|
|
223
|
+
};
|
|
224
|
+
"912"?: undefined;
|
|
225
|
+
};
|
|
226
|
+
match: string;
|
|
227
|
+
name: string;
|
|
228
|
+
comment?: undefined;
|
|
229
|
+
} | {
|
|
230
|
+
match: string;
|
|
231
|
+
name: string;
|
|
232
|
+
captures?: undefined;
|
|
233
|
+
comment?: undefined;
|
|
234
|
+
})[];
|
|
235
|
+
};
|
|
236
|
+
heading: {
|
|
237
|
+
match: string;
|
|
238
|
+
captures: {
|
|
239
|
+
"1": {
|
|
240
|
+
patterns: {
|
|
241
|
+
match: string;
|
|
242
|
+
name: string;
|
|
243
|
+
captures: {
|
|
244
|
+
"1": {
|
|
245
|
+
name: string;
|
|
246
|
+
};
|
|
247
|
+
"2": {
|
|
248
|
+
name: string;
|
|
249
|
+
patterns: {
|
|
250
|
+
include: string;
|
|
251
|
+
}[];
|
|
252
|
+
};
|
|
253
|
+
"3": {
|
|
254
|
+
name: string;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
}[];
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
name: string;
|
|
261
|
+
patterns: {
|
|
262
|
+
include: string;
|
|
263
|
+
}[];
|
|
264
|
+
};
|
|
265
|
+
"heading-setext": {
|
|
266
|
+
patterns: {
|
|
267
|
+
match: string;
|
|
268
|
+
name: string;
|
|
269
|
+
}[];
|
|
270
|
+
};
|
|
271
|
+
lists: {
|
|
272
|
+
patterns: ({
|
|
273
|
+
begin: string;
|
|
274
|
+
beginCaptures: {
|
|
275
|
+
"3": {
|
|
276
|
+
name: string;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
comment: string;
|
|
280
|
+
name: string;
|
|
281
|
+
patterns: {
|
|
282
|
+
include: string;
|
|
283
|
+
}[];
|
|
284
|
+
while: string;
|
|
285
|
+
} | {
|
|
286
|
+
begin: string;
|
|
287
|
+
beginCaptures: {
|
|
288
|
+
"3": {
|
|
289
|
+
name: string;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
name: string;
|
|
293
|
+
patterns: {
|
|
294
|
+
include: string;
|
|
295
|
+
}[];
|
|
296
|
+
while: string;
|
|
297
|
+
comment?: undefined;
|
|
298
|
+
})[];
|
|
299
|
+
};
|
|
300
|
+
paragraph: {
|
|
301
|
+
begin: string;
|
|
302
|
+
name: string;
|
|
303
|
+
patterns: {
|
|
304
|
+
include: string;
|
|
305
|
+
}[];
|
|
306
|
+
while: string;
|
|
307
|
+
};
|
|
308
|
+
blockquote: {
|
|
309
|
+
begin: string;
|
|
310
|
+
captures: {
|
|
311
|
+
"2": {
|
|
312
|
+
name: string;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
name: string;
|
|
316
|
+
patterns: {
|
|
317
|
+
include: string;
|
|
318
|
+
}[];
|
|
319
|
+
while: string;
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
export default grammar;
|