@raketa-builder/support 1.4.7 → 1.4.9

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.
Files changed (2) hide show
  1. package/dist/toHTML.js +1 -37
  2. package/package.json +1 -1
package/dist/toHTML.js CHANGED
@@ -4,76 +4,43 @@ import parseAttrs from 'attributes-parser';
4
4
 
5
5
  const toHTML = (string, inline = false) => {
6
6
  if (!string) return "";
7
- console.log("=== toHTML called ===");
8
- console.log("Input string:", string);
9
- console.log("Inline mode:", inline);
10
7
  const markedInstance = new Marked();
11
8
  const attributes = {
12
9
  name: "attributes",
13
10
  level: "inline",
14
11
  start(src) {
15
12
  const result = src[0] === "{" ? 0 : void 0;
16
- console.log(
17
- "attributes.start called with:",
18
- src.substring(0, 50),
19
- "result:",
20
- result
21
- );
22
13
  return result;
23
14
  },
24
15
  tokenizer(src, tokens) {
25
- console.log("=== tokenizer called ===");
26
- console.log("src:", src.substring(0, 100));
27
- console.log("tokens length:", tokens.length);
28
- console.log(
29
- "last 3 tokens:",
30
- tokens.slice(-3).map((t) => ({ type: t.type, raw: t.raw }))
31
- );
32
16
  const match = /^\{([^}]*)\}/.exec(src);
33
- console.log("regex match:", match);
34
17
  if (match && tokens.length > 0) {
35
18
  const last = tokens[tokens.length - 1];
36
- console.log("last token:", {
37
- type: last.type,
38
- raw: last.raw,
39
- href: last.href,
40
- text: last.text
41
- });
42
- if (last.type === "link" && last.raw && src.startsWith("{", 0)) {
43
- console.log("Processing attributes for link:", last.raw);
19
+ if (last.type === "link" && last.raw) {
44
20
  try {
45
21
  last.attributes = parseAttrs(match[1]);
46
- console.log("Parsed attributes:", last.attributes);
47
22
  return {
48
23
  type: "attributes",
49
24
  raw: match[0]
50
25
  };
51
26
  } catch (error) {
52
- console.error("Error parsing attributes:", error);
53
27
  return false;
54
28
  }
55
29
  }
56
30
  }
57
- console.log("tokenizer returning false");
58
- console.log("========================");
59
31
  return false;
60
32
  },
61
33
  renderer(token) {
62
- console.log("attributes.renderer called with:", token);
63
34
  return "";
64
35
  }
65
36
  };
66
37
  const renderer = {
67
38
  link(token) {
68
- console.log("=== link renderer ===");
69
- console.log("token:", token);
70
39
  let attributeString = "";
71
40
  if (token.attributes) {
72
41
  attributeString = Object.entries(token.attributes).map(([key, value]) => ` ${key}="${value}"`).join("");
73
- console.log("attributeString:", attributeString);
74
42
  }
75
43
  const result = `<a href="${token.href}"${attributeString}>${token.text}</a>`;
76
- console.log("link result:", result);
77
44
  return result;
78
45
  }
79
46
  };
@@ -90,12 +57,9 @@ const toHTML = (string, inline = false) => {
90
57
  });
91
58
  try {
92
59
  const result = inline ? markedInstance.parseInline(string) : markedInstance.parse(string);
93
- console.log("Final result:", result);
94
- console.log("======================");
95
60
  return result;
96
61
  } catch (error) {
97
62
  console.error("Parse error:", error);
98
- console.log("======================");
99
63
  throw error;
100
64
  }
101
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/support",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",