@raketa-builder/support 1.4.6 → 1.4.7

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