@changerawr/markdown 1.1.7 → 1.1.8
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +80 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -7
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.js +80 -7
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +80 -7
- package/dist/react/index.mjs.map +1 -1
- package/dist/standalone.browser.js +103 -19
- package/dist/standalone.js +80 -7
- package/dist/standalone.js.map +1 -1
- package/dist/standalone.mjs +80 -7
- package/dist/standalone.mjs.map +1 -1
- package/package.json +1 -1
package/dist/standalone.mjs
CHANGED
|
@@ -999,7 +999,8 @@ var ImageExtension = {
|
|
|
999
999
|
attributes: {
|
|
1000
1000
|
alt: match[1] || "",
|
|
1001
1001
|
src: match[2] || "",
|
|
1002
|
-
|
|
1002
|
+
caption: match[3] || ""
|
|
1003
|
+
// Renamed from 'title' to 'caption' for clarity
|
|
1003
1004
|
}
|
|
1004
1005
|
})
|
|
1005
1006
|
}
|
|
@@ -1010,13 +1011,24 @@ var ImageExtension = {
|
|
|
1010
1011
|
render: (token) => {
|
|
1011
1012
|
const src = token.attributes?.src || "";
|
|
1012
1013
|
const alt = token.attributes?.alt || "";
|
|
1013
|
-
const
|
|
1014
|
-
const titleAttr = title ? ` title="${escapeHtml(title)}"` : "";
|
|
1014
|
+
const caption = token.attributes?.caption || "";
|
|
1015
1015
|
const format = token.attributes?.format || "html";
|
|
1016
|
+
if (caption) {
|
|
1017
|
+
if (format === "html") {
|
|
1018
|
+
return `<figure style="margin: 16px 0; text-align: center;">
|
|
1019
|
+
<img src="${escapeHtml(src)}" alt="${escapeHtml(alt)}" style="max-width: 100%; height: auto; border-radius: 8px;" loading="lazy" />
|
|
1020
|
+
<figcaption style="margin-top: 8px; font-size: 14px; color: #6b7280; font-style: italic;">${escapeHtml(caption)}</figcaption>
|
|
1021
|
+
</figure>`;
|
|
1022
|
+
}
|
|
1023
|
+
return `<figure class="my-4 text-center">
|
|
1024
|
+
<img src="${escapeHtml(src)}" alt="${escapeHtml(alt)}" class="max-w-full h-auto rounded-lg" loading="lazy" />
|
|
1025
|
+
<figcaption class="mt-2 text-sm text-gray-500 italic">${escapeHtml(caption)}</figcaption>
|
|
1026
|
+
</figure>`;
|
|
1027
|
+
}
|
|
1016
1028
|
if (format === "html") {
|
|
1017
|
-
return `<img src="${escapeHtml(src)}" alt="${escapeHtml(alt)}"
|
|
1029
|
+
return `<img src="${escapeHtml(src)}" alt="${escapeHtml(alt)}" style="max-width: 100%; height: auto; border-radius: 8px; margin: 16px 0;" loading="lazy" />`;
|
|
1018
1030
|
}
|
|
1019
|
-
return `<img src="${escapeHtml(src)}" alt="${escapeHtml(alt)}"
|
|
1031
|
+
return `<img src="${escapeHtml(src)}" alt="${escapeHtml(alt)}" class="max-w-full h-auto rounded-lg my-4" loading="lazy" />`;
|
|
1020
1032
|
}
|
|
1021
1033
|
}
|
|
1022
1034
|
]
|
|
@@ -1068,12 +1080,31 @@ var ListExtension = {
|
|
|
1068
1080
|
name: "list",
|
|
1069
1081
|
parseRules: [
|
|
1070
1082
|
{
|
|
1071
|
-
name: "list-item",
|
|
1083
|
+
name: "unordered-list-item",
|
|
1072
1084
|
pattern: /^(\s*)[-*+]\s+(.+)$/m,
|
|
1073
1085
|
render: (match) => ({
|
|
1074
1086
|
type: "list-item",
|
|
1075
1087
|
content: match[2] || "",
|
|
1076
|
-
raw: match[0] || ""
|
|
1088
|
+
raw: match[0] || "",
|
|
1089
|
+
attributes: {
|
|
1090
|
+
indent: match[1]?.length || 0,
|
|
1091
|
+
ordered: false,
|
|
1092
|
+
marker: match[1] ? match[0].match(/[-*+]/)?.[0] : "-"
|
|
1093
|
+
}
|
|
1094
|
+
})
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: "ordered-list-item",
|
|
1098
|
+
pattern: /^(\s*)(\d+)\.\s+(.+)$/m,
|
|
1099
|
+
render: (match) => ({
|
|
1100
|
+
type: "ordered-list-item",
|
|
1101
|
+
content: match[3] || "",
|
|
1102
|
+
raw: match[0] || "",
|
|
1103
|
+
attributes: {
|
|
1104
|
+
indent: match[1]?.length || 0,
|
|
1105
|
+
ordered: true,
|
|
1106
|
+
number: parseInt(match[2] || "1")
|
|
1107
|
+
}
|
|
1077
1108
|
})
|
|
1078
1109
|
}
|
|
1079
1110
|
],
|
|
@@ -1088,6 +1119,17 @@ var ListExtension = {
|
|
|
1088
1119
|
}
|
|
1089
1120
|
return `<li>${content}</li>`;
|
|
1090
1121
|
}
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
type: "ordered-list-item",
|
|
1125
|
+
render: (token) => {
|
|
1126
|
+
const format = token.attributes?.format || "tailwind";
|
|
1127
|
+
const content = token.attributes?.renderedChildren || escapeHtml(token.content);
|
|
1128
|
+
if (format === "html") {
|
|
1129
|
+
return `<li>${content}</li>`;
|
|
1130
|
+
}
|
|
1131
|
+
return `<li>${content}</li>`;
|
|
1132
|
+
}
|
|
1091
1133
|
}
|
|
1092
1134
|
]
|
|
1093
1135
|
};
|
|
@@ -1102,6 +1144,7 @@ var TaskListExtension = {
|
|
|
1102
1144
|
content: match[3] || "",
|
|
1103
1145
|
raw: match[0] || "",
|
|
1104
1146
|
attributes: {
|
|
1147
|
+
indent: match[1]?.length || 0,
|
|
1105
1148
|
checked: String((match[2] || "").toLowerCase() === "x")
|
|
1106
1149
|
}
|
|
1107
1150
|
})
|
|
@@ -1167,6 +1210,35 @@ var TextExtension = {
|
|
|
1167
1210
|
]
|
|
1168
1211
|
};
|
|
1169
1212
|
|
|
1213
|
+
// src/extensions/core/strikethrough.ts
|
|
1214
|
+
var StrikethroughExtension = {
|
|
1215
|
+
name: "strikethrough",
|
|
1216
|
+
parseRules: [
|
|
1217
|
+
{
|
|
1218
|
+
name: "strikethrough",
|
|
1219
|
+
pattern: /~~((?:(?!~~).)+)~~/,
|
|
1220
|
+
render: (match) => ({
|
|
1221
|
+
type: "strikethrough",
|
|
1222
|
+
content: match[1] || "",
|
|
1223
|
+
raw: match[0] || ""
|
|
1224
|
+
})
|
|
1225
|
+
}
|
|
1226
|
+
],
|
|
1227
|
+
renderRules: [
|
|
1228
|
+
{
|
|
1229
|
+
type: "strikethrough",
|
|
1230
|
+
render: (token) => {
|
|
1231
|
+
const content = escapeHtml(token.content);
|
|
1232
|
+
const format = token.attributes?.format;
|
|
1233
|
+
if (format === "html") {
|
|
1234
|
+
return `<del style="text-decoration: line-through; color: #6b7280;">${content}</del>`;
|
|
1235
|
+
}
|
|
1236
|
+
return `<del class="line-through text-gray-500">${content}</del>`;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
]
|
|
1240
|
+
};
|
|
1241
|
+
|
|
1170
1242
|
// src/extensions/core/index.ts
|
|
1171
1243
|
var CoreExtensions = [
|
|
1172
1244
|
TextExtension,
|
|
@@ -1181,6 +1253,7 @@ var CoreExtensions = [
|
|
|
1181
1253
|
TaskListExtension,
|
|
1182
1254
|
BlockquoteExtension,
|
|
1183
1255
|
HorizontalRuleExtension,
|
|
1256
|
+
StrikethroughExtension,
|
|
1184
1257
|
ParagraphExtension,
|
|
1185
1258
|
LineBreakExtension
|
|
1186
1259
|
];
|