@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.
@@ -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) => `<li>${escapeHtml(token.content)}</li>`
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 escapedContent = escapeHtml(token.content);
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;"' : ""}>${escapedContent}</span>
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"' : ""}>${escapedContent}</span>
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+)(?:\s+(.*?))?\s*\n([\s\S]*?)\n:::/,
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
  }