@changerawr/markdown 1.1.4 → 1.1.5
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/css/index.css +3 -123
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -8
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +15 -8
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +15 -8
- package/dist/react/index.mjs.map +1 -1
- package/dist/standalone.browser.js +19 -11
- package/dist/standalone.d.mts +1 -1
- package/dist/standalone.d.ts +1 -1
- package/dist/standalone.js +15 -8
- package/dist/standalone.js.map +1 -1
- package/dist/standalone.mjs +15 -8
- package/dist/standalone.mjs.map +1 -1
- package/dist/tailwind/index.d.mts +4 -35
- package/dist/tailwind/index.d.ts +4 -35
- package/dist/tailwind/index.js +120 -185
- package/dist/tailwind/index.js.map +1 -1
- package/dist/tailwind/index.mjs +119 -183
- package/dist/tailwind/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/react/index.mjs
CHANGED
|
@@ -203,7 +203,7 @@ var MarkdownParser = class {
|
|
|
203
203
|
return processed;
|
|
204
204
|
}
|
|
205
205
|
recursivelyParseBlockContent(token) {
|
|
206
|
-
const blockTypes = ["alert", "blockquote"];
|
|
206
|
+
const blockTypes = ["alert", "blockquote", "list-item", "task-item"];
|
|
207
207
|
if (blockTypes.includes(token.type) && token.content && token.content.trim()) {
|
|
208
208
|
const children = this.parse(token.content);
|
|
209
209
|
return {
|
|
@@ -914,7 +914,14 @@ var ListExtension = {
|
|
|
914
914
|
renderRules: [
|
|
915
915
|
{
|
|
916
916
|
type: "list-item",
|
|
917
|
-
render: (token) =>
|
|
917
|
+
render: (token) => {
|
|
918
|
+
const format = token.attributes?.format || "tailwind";
|
|
919
|
+
const content = token.attributes?.renderedChildren || escapeHtml(token.content);
|
|
920
|
+
if (format === "html") {
|
|
921
|
+
return `<li>${content}</li>`;
|
|
922
|
+
}
|
|
923
|
+
return `<li>${content}</li>`;
|
|
924
|
+
}
|
|
918
925
|
}
|
|
919
926
|
]
|
|
920
927
|
};
|
|
@@ -939,18 +946,18 @@ var TaskListExtension = {
|
|
|
939
946
|
type: "task-item",
|
|
940
947
|
render: (token) => {
|
|
941
948
|
const isChecked = token.attributes?.checked === "true";
|
|
942
|
-
const
|
|
949
|
+
const content = token.attributes?.renderedChildren || escapeHtml(token.content);
|
|
943
950
|
const format = token.attributes?.format || "html";
|
|
944
951
|
if (format === "html") {
|
|
945
952
|
return `<div style="display: flex; align-items: center; gap: 8px; margin: 8px 0;">
|
|
946
953
|
<input type="checkbox" ${isChecked ? "checked" : ""} disabled style="margin: 0;" />
|
|
947
|
-
<span${isChecked ? ' style="text-decoration: line-through; color: #6b7280;"' : ""}>${
|
|
954
|
+
<span${isChecked ? ' style="text-decoration: line-through; color: #6b7280;"' : ""}>${content}</span>
|
|
948
955
|
</div>`;
|
|
949
956
|
}
|
|
950
957
|
return `<div class="flex items-center gap-2 my-2 task-list-item">
|
|
951
|
-
<input type="checkbox" ${isChecked ? "checked" : ""} disabled
|
|
958
|
+
<input type="checkbox" ${isChecked ? "checked" : ""} disabled
|
|
952
959
|
class="form-checkbox h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary" />
|
|
953
|
-
<span${isChecked ? ' class="line-through text-muted-foreground"' : ""}>${
|
|
960
|
+
<span${isChecked ? ' class="line-through text-muted-foreground"' : ""}>${content}</span>
|
|
954
961
|
</div>`;
|
|
955
962
|
}
|
|
956
963
|
}
|
|
@@ -1018,7 +1025,7 @@ var AlertExtension = {
|
|
|
1018
1025
|
parseRules: [
|
|
1019
1026
|
{
|
|
1020
1027
|
name: "alert",
|
|
1021
|
-
pattern: /:::(\w+)(
|
|
1028
|
+
pattern: /:::(\w+)(?: ([^\n]+))?\n([\s\S]*?)\n:::/,
|
|
1022
1029
|
render: (match) => {
|
|
1023
1030
|
return {
|
|
1024
1031
|
type: "alert",
|
|
@@ -1026,7 +1033,7 @@ var AlertExtension = {
|
|
|
1026
1033
|
raw: match[0] || "",
|
|
1027
1034
|
attributes: {
|
|
1028
1035
|
type: match[1] || "info",
|
|
1029
|
-
title: match[2] || ""
|
|
1036
|
+
title: match[2]?.trim() || ""
|
|
1030
1037
|
}
|
|
1031
1038
|
};
|
|
1032
1039
|
}
|