@md-plugins/md-plugin-codeblocks 0.1.0-alpha.16 → 0.1.0-alpha.17
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/dist/index.mjs +5 -5
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -76,13 +76,13 @@ const codeblocksPlugin = (md, {
|
|
|
76
76
|
function extractCodeLineProps(lines, attrs) {
|
|
77
77
|
const acc = {};
|
|
78
78
|
for (const type of magicCommentList) {
|
|
79
|
-
acc[type] = attrs[type] !==
|
|
79
|
+
acc[type] = attrs[type] !== undefined ? attrs[type].split(",") : [];
|
|
80
80
|
}
|
|
81
81
|
lines.forEach((line, lineIndex) => {
|
|
82
82
|
const match = line.match(magicCommentRE);
|
|
83
83
|
if (match !== null) {
|
|
84
84
|
const type = match.groups?.type;
|
|
85
|
-
if (type !==
|
|
85
|
+
if (type !== undefined) {
|
|
86
86
|
acc[type].push("" + (lineIndex + 1));
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -104,7 +104,7 @@ const codeblocksPlugin = (md, {
|
|
|
104
104
|
const target = props[type];
|
|
105
105
|
for (const value of target) {
|
|
106
106
|
let [from, to] = value.split("-").map((i) => parseInt(i, 10));
|
|
107
|
-
if (to ===
|
|
107
|
+
if (to === undefined) to = from;
|
|
108
108
|
for (let i = from; i <= to; i++) {
|
|
109
109
|
acc[i - 1].classList.push(`line-${type}`);
|
|
110
110
|
}
|
|
@@ -142,7 +142,7 @@ const codeblocksPlugin = (md, {
|
|
|
142
142
|
lineHtml += line;
|
|
143
143
|
return lineHtml;
|
|
144
144
|
}).join("\n");
|
|
145
|
-
const preAttrs = maxheight !==
|
|
145
|
+
const preAttrs = maxheight !== undefined ? ` style="max-height:${maxheight}"` : "";
|
|
146
146
|
const langProp = customCopyLangList.includes(lang) === true ? ` lang="${lang}"` : "";
|
|
147
147
|
return (
|
|
148
148
|
// `<pre v-pre class="${preClass}${langClass}"${preAttrs}>` +
|
|
@@ -193,7 +193,7 @@ const codeblocksPlugin = (md, {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
const attrs = parseDefinitionLine(token);
|
|
196
|
-
return `<${containerComponent}${attrs.title !== null ? ` title="${attrs.title}"` : ""}${attrs.tabs !==
|
|
196
|
+
return `<${containerComponent}${attrs.title !== null ? ` title="${attrs.title}"` : ""}${attrs.tabs !== undefined ? ` :tabs="${attrs.tabs.param}"` : ""}>` + (attrs.tabs !== undefined ? attrs.tabs.content : getHighlightedContent(token.content, attrs)) + `</${containerComponent}>`;
|
|
197
197
|
};
|
|
198
198
|
};
|
|
199
199
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@md-plugins/md-plugin-codeblocks",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.17",
|
|
4
4
|
"description": "A markdown-it plugin for code blocks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prismjs": "^1.29.0",
|
|
41
41
|
"@types/markdown-it": "^14.1.2",
|
|
42
42
|
"@types/prismjs": "^1.26.5",
|
|
43
|
-
"@md-plugins/shared": "0.1.0-alpha.
|
|
43
|
+
"@md-plugins/shared": "0.1.0-alpha.17"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"markdown-it": "^14.1.0",
|